User Profile

Collapse

Profile Sidebar

Collapse
CapriPHR
CapriPHR
Last Activity: Jan 12 '12, 03:03 PM
Joined: Jan 5 '12
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • Here is the VB code that finally worked:
    Code:
    Private Sub CustomerName_AfterUpdate()
    Me![ProductID] = DLookup("ProductID", "Table1", "CustomerName = '" & Me!CustomerName & "'")
    Me![CustomerAddr] = DLookup("CustomerAddr", "Table1", "CustomerName = '" & Me!CustomerName & "'")
    Me![ComplaintLevel] = DLookup("ComplaintLevel", "Table1",
    ...
    See more | Go to post
    Last edited by NeoPa; Jan 8 '12, 06:25 PM. Reason: Added mandatory [CODE] tags for you

    Leave a comment:


  • Thank you for the feedback, Stewart. I wrote the code that way because I was instructed by other resources to use that format. Writing the code as you have indicated did not fix the problem. I didn't get another error message, but nothing happened at all once I selected CustomerName.

    I adjusted the formatting of fields and VB code as follows and now it returns a value for ProductID, but not the one associated with the specified CustomerName:...
    See more | Go to post
    Last edited by NeoPa; Jan 8 '12, 06:24 PM. Reason: Code only returns first record. Added mandatory [CODE] tags for you.

    Leave a comment:


  • CapriPHR
    started a topic Compile Error: Sub or Function Not Defined

    Compile Error: Sub or Function Not Defined

    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...
    See more | Go to post
    Last edited by NeoPa; Jan 8 '12, 06:24 PM. Reason: Added mandatory [CODE] tags for you
No activity results to display
Show More
Working...