Nik
Nik

Reputation: 41

Access 2016 Form auto-populate based on another field

I've got two tables that contain the following.

Table Name: Enquiries

Table Name: PC

I currently have a Form setup with the above fields all selected. I have PCArea setup as a drop down as the field has 2000+ records (Postcodes). What I want is when a person updates this field/drop down/combo box for Access to lookup the PCArea and find out what the DCName is relevant to this and then populate the DC field in "Enquiries" and show on the form but I can't fathom how to do it.

I know it's VBA related but I can't seem to get the format right?

Private Sub Combo472_AfterUpdate()

Me.PCArea = Me.Data.Column(9)

End Sub

Sure didn't work! Any help would be great.

Upvotes: 0

Views: 4446

Answers (1)

geeFlo
geeFlo

Reputation: 375

Replace {PCAreaDropDown} with name of your dropdown box, and all you really need is the one field in there. It looks like you threw at least 10 columns (9+1) based on your example.

me!DC = dlookup("DCName","PC", "PCArea = '" & me!PcAreaDropDown & "'"

Upvotes: 1

Related Questions