Hello all.
I am trying to use DLookup to auto-populate fields in an otherwise simple database. I am using Access 2010. I have created three different databases and the code still does not work. I think there may be glitches in this particular copy of the program. Please evaluate the details below and tell me what you think.
Table 1 has fields: Product ID, CustomerName, CustomerAddr, and ComplaintLevel.
Table 2 has fields: Resolution ID, CustomerName, CustomerAddr, Product ID, ComplaintLevel, ResolutionDate.
I want DLookup to populate Product ID field of Table 2 once CustomerName has been selected. CustomerName options are provided via a combo box that pulls from Table 1.
Here is my code:
I get a Compile Error. What do you suppose is at issue here?
I am trying to use DLookup to auto-populate fields in an otherwise simple database. I am using Access 2010. I have created three different databases and the code still does not work. I think there may be glitches in this particular copy of the program. Please evaluate the details below and tell me what you think.
Table 1 has fields: Product ID, CustomerName, CustomerAddr, and ComplaintLevel.
Table 2 has fields: Resolution ID, CustomerName, CustomerAddr, Product ID, ComplaintLevel, ResolutionDate.
I want DLookup to populate Product ID field of Table 2 once CustomerName has been selected. CustomerName options are provided via a combo box that pulls from Table 1.
Here is my code:
Code:
Private Sub CustomerName_AfterUpdate()
Product ID = DLookup("Product ID", "Table 1", "CustomerName=" & CustomerName)
End Sub
Comment