Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Populate Fields via Check Box

Status
Not open for further replies.

thefourthwall

IS-IT--Management
Feb 26, 2002
387
US
I am having trouble getting the results I want in a form, please help.

The first section has "Contact" fields like name, location, ph#, etc.

The second section has "Drop Off" fields (again, name, office location, ph#, etc.).

If the Drop Off info is the same as Contact, I want the user to tick a checkbox, which will populate Drop Off fields based on Contact fields ... but am having trouble making it work.

I'm new to Access, and have learned much form the various Access forums but this issue really has me stumped ... thanks.
 
in the AfterUpdate event of the checkbox put.... ( just fix the names to match yours).

* if you don't know VBA, don't panic...just go to design then go to properties of the checkbox, click the Event tab...click the small button to the right of the line and choose code window...the portion "Private sub" and "End Sub" ( begining and ending) should be omitted from my example and only paste what is in between...when done it should look like mine ( except with naming corrected to match.


Private Sub Check1_AfterUpdate()

If Me.Check1 = True Then


Me.DropOff = Me.Contact
' so you can't change while checked
Me.DropOff .Enabled = True

Else

' allows you to change
Me.DropOff .Enabled = True

End If


End Sub
 
oh I made a mistake...

Private Sub Check1_AfterUpdate()

If Me.Check1 = True Then


Me.DropOff = Me.Contact
' so you can't change while checked
Me.DropOff .Enabled = False

Else

' allows you to change
Me.DropOff .Enabled = True

End If


End Sub
 
ZiggyS1,

Thanks, I appreciate that as I was stuck on this. My knowledge of VBA is pretty thin, actually, but I am starting to get better at it. I did understand what your code does, but didn't know beforehand how to generate the code myself.

An amusing thing happens now though: Every field populates except the phone number field; however, if I then click on the phone number field, the "populated" data shows up ... strange!

Thanks again.
-thefourthwall
 
it works best with the form set to Single Mode, so if you have the form set to Continuous remove the Enabled true/false section....the copy part will still work for the record
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top