Results 1 to 5 of 5
  1. #1
    wongc61 is offline Novice
    Windows XP Access 2007
    Join Date
    Jul 2011
    Posts
    2

    Form Design Question with DLookup (newbie)

    This is my first new thread. I'm a newbie trying to design a production database at a manufacturing facility. MS Access 2007. Here is question:



    In my Form "DAILY PRODUCTION" the operator selects a PART NUMBER from a combo box. This combo box's source is a Table named "PART NUMBERS & CYCLE TIMES" that lists every PART NUMBER and its corresponding CYCLE TIME.

    I want add a text box and use the DLookup function, such that when the operator picks the PART NUMBER, the CYCLE TIME will automatically appear in that text box for that PART NUMBER.

    I can't get it to work, because I cannot get the syntax correct. Can anyone help me by typing out the correct syntax? Thank you for the help!

    Also, if the DLookup function is not the best solution, please let me know. THX

  2. #2
    TheShabz is offline Court Jester
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    1,368
    in the AfterUpdate event (properties>events) click the ... and select Code Builder. when the VBA window opens, you should see
    Code:
    Private Sub comboName_Update()
    
    End Sub
    Between that type in
    Code:
    Me.nameOfTextBox = DLookup("[Cycle Time]", "[PART NUMBERS & CYCLE TIMES]","[PART NUMBER] = " & Me.comboBoxName)
    Also, it's a good idea to remove all spaces and special characters from your table names and field names. It will save you many headaches.

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    An alternative to the DLookup:

    http://www.baldyweb.com/Autofill.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    wongc61 is offline Novice
    Windows XP Access 2007
    Join Date
    Jul 2011
    Posts
    2

    Thanks!

    I appreciate the help and the advice.

  5. #5
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    Quote Originally Posted by pbaldy View Post
    An alternative to the DLookup:

    http://www.baldyweb.com/Autofill.htm
    I would use Paul's suggestion over a DLookup. DLookups are notoriously slow.

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

Similar Threads

  1. Form Design Question
    By mmori in forum Forms
    Replies: 0
    Last Post: 02-21-2011, 04:52 PM
  2. Newbie needs help with survey design
    By Buakaw in forum Database Design
    Replies: 5
    Last Post: 01-20-2011, 10:20 PM
  3. Newbie Dlookup problem
    By opopanax666 in forum Programming
    Replies: 7
    Last Post: 08-13-2010, 05:47 AM
  4. Help needed with table design/layout for newbie
    By jase118 in forum Database Design
    Replies: 8
    Last Post: 06-05-2010, 02:59 AM
  5. newbie needs design help
    By ashiers in forum Database Design
    Replies: 0
    Last Post: 09-13-2008, 07:05 PM

Tags for this Thread

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