Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2005

    access checkbox

    Hi all

    Im using the following on an ms access form. (the control source of chkSameShip is a yes/no field in the Database)

    Private Sub chkSameShip_Click()
    If Me![chkShipSame] = True Then

    Me![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. 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?

    Please help!

  2. #2
    Join Date
    Dec 2005
    Wilmington, DE - USA
    Consider using the AfterUpdate event instead. That way, as you move to other records, if the value changed, the sub will fire...

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Checkbox controlling text box
    By chuckduarte in forum Forms
    Replies: 0
    Last Post: 10-21-2008, 10:45 AM
  2. checkbox
    By Suresh in forum Forms
    Replies: 0
    Last Post: 12-19-2007, 01:30 AM
  3. Make entries uneditable based on checkbox
    By acehowell in forum Programming
    Replies: 1
    Last Post: 04-19-2007, 07:54 AM
  4. easy checkbox question
    By nelsok in forum Forms
    Replies: 1
    Last Post: 06-09-2006, 05:46 PM
  5. Checkbox to update value
    By Wrangler in forum Forms
    Replies: 1
    Last Post: 01-03-2006, 06:34 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Other Forums: Microsoft Office Forums