Results 1 to 3 of 3
  1. #1
    cbrsix is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2011
    Posts
    214

    Dlookup

    I have a form that I want to use the dlookup function. I want this form to look up the AccountNumber that I type in and I want it to grab the Company Name and Account Type from the client table. The Company Name information, from the client table, is a drop down menu that draws from a query I had set up. The Account Type information, from the client table, is just a drop down list created in that table (no query).

    Here is what I thought would work, but it's not. Any ideas? Does the query mess it up?

    Private Sub AccountNumber_AfterUpdate()
    Company = DLookup("Company Name", "Account List", "Account Number=" & AccountNumber)


    AccountType = DLookup("Account Type", "Account List", "Account Number=" & AccountNumber)

    End Sub

  2. #2
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    Why not just use a combo box with AutoExpand on? Then you can simply start to type and it will "find" the record. The Company and Account Type can just be fields in the Combo's Row Source which then can be referenced from the controls that display it:

    =[ComboNameHere].[Column](1) ' for the second column as it is zero-based
    =[ComboNameHere].[Column](2) ' for the third column

    And you should not be storing this information in another table so just displaying it like that would be the best.

  3. #3
    cbrsix is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2011
    Posts
    214
    Thanks you.

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

Similar Threads

  1. Dlookup
    By cbrsix in forum Forms
    Replies: 6
    Last Post: 11-01-2011, 10:38 AM
  2. DLookUp Help
    By ThaGreenMoose in forum Forms
    Replies: 10
    Last Post: 06-15-2011, 12:08 PM
  3. May it is Dlookup
    By cap.zadi in forum Programming
    Replies: 3
    Last Post: 05-09-2011, 05:58 AM
  4. DLookup()
    By jgelpi16 in forum Programming
    Replies: 2
    Last Post: 09-15-2010, 07:20 AM
  5. Dlookup??
    By Vikki in forum Access
    Replies: 4
    Last Post: 02-16-2010, 07:59 AM

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