Forum Moderators: open
Private Sub chkSameShip_Click()
If Me![chkShipSame] = True ThenMe![LastNameShip] = Me![LastName]
Me![FirstNameShip] = Me![FirstName]
Me![AddressShip] = Me![Address]
Me![DistrictShip] = Me![District]
Me![CityShip] = Me![City]
Me![CountyShip] = Me![County]
Me![CountryShip] = Me![Country]
Me![PostcodeShip] = Me![Postcode]
Me![LastNameShip].Enabled = False
Me![FirstNameShip].Enabled = False
Me![AddressShip].Enabled = False
Me![DistrictShip].Enabled = False
Me![CityShip].Enabled = False
Me![CountyShip].Enabled = False
Me![CountryShip].Enabled = False
Me![PostcodeShip].Enabled = False
End If
If Me![chkShipSame] = False Then
Me![LastNameShip].Enabled = True
Me![FirstNameShip].Enabled = True
Me![AddressShip].Enabled = True
Me![DistrictShip].Enabled = True
Me![CityShip].Enabled = True
Me![CountyShip].Enabled = True
Me![CountryShip].Enabled = True
Me![PostcodeShip].Enabled = True
End If
End Sub
Basically the form lists the users name and address, if you check the box then it copies these details into the "Ship to" fields because the ship to address would be the same as the invoice address. It then disables the ship to fields to that you cant edit them However, it works but if I then scroll to the next record then the fields remain disabled even though the checkbox is not checked. Please help!
edit.. i think i need to change the "Private Sub chkSameShip_Click()" because i need it to work even if you dont click on the checkbox?
Been a while since I've done this, but I think you need to add the same code to the form's "On Current" event. Put it in a separate sub and call it from the checkbox click and form on current events.