Results 1 to 2 of 2
  1. #1
    Canadiangal is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Sep 2009
    Posts
    81

    Auto populating on a Form

    After reading through the forums I saw some code on how to auto populate unbound controls on a form. However, I don't quite understand the code. Could someone explain to me where I put what.

    Use a Dlookup on the Afterupdate event:
    Me.[field name to be populated] = Dlookup("Field", "Table", "Field ='" & me.[Fieldname] & "'")


    Also add an unbound textbox (you can lock it if you want, so it can't be changed).

    So I have an unbound field called City and I want it to populate the unbound field called zip code. Here is what I wrote, but it does not work.

    me.[zipcode]=Dlookup("zipcode", "Employees", "city='" & me.[city] & "'")

    Can anyone tell me what I am doing wrong here? I wrote this on the unbound field called City.

  2. #2
    Canadiangal is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Sep 2009
    Posts
    81
    Whoops, got it. Zipcode on my form, but postal code on my table.

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

Similar Threads

  1. Auto Populating a new form
    By mikejames in forum Access
    Replies: 12
    Last Post: 09-25-2011, 11:41 AM
  2. Replies: 1
    Last Post: 09-08-2011, 06:36 PM
  3. Auto populating Form controls
    By eww in forum Forms
    Replies: 1
    Last Post: 08-09-2010, 12:49 PM
  4. new guy with a question on auto populating
    By zdiver07 in forum Forms
    Replies: 2
    Last Post: 05-03-2010, 11:06 PM
  5. Auto populating date.
    By emccalment in forum Access
    Replies: 3
    Last Post: 02-19-2010, 11:00 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