Results 1 to 6 of 6
  1. #1
    fun4all is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jun 2012
    Posts
    3

    Forms not reflecting changes made on VB Editor

    Hello,

    I am very new to Microsoft Access and need some help using VB editor to customize forms. I entered code for an event that creates an auto fill-in form that completes the form according to what is selected in a combo box. But when I go to select a record in the combo box, none of the other fields on the form update. Also, the empty fields still act as if no changes were made to the event (goes down a list of records as I press Tab).

    My event looks like this:

    Option Compare Database
    Option Explicit


    Private Sub LastName_AfterUpdate()

    Me.FirstName = DLookup("FirstName", "Table1", "ID=" & ID)

    Me.Address = DLookup("Address", "Table1", "ID=" & ID)
    Me.City = DLookup("City", "Table1", "ID=" & ID)

    End Sub



    Which is suppose to fill out text boxes named FirstName, Address, and City depending on the LastName selected in a combo box.




    Thanks in advance for the help!

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Where is your system to get the ID you need to do the Lookup's?

  3. #3
    fun4all is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jun 2012
    Posts
    3
    I'm sorry I don't really understand what I need regarding the ID lookup. I thought I could refer to the ID as any other field on the datasheet? Could you please elaborate a bit?

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    In order for us to communicate successfully we need to be real specific in what we call objects.
    Is your form in Datasheet View?
    Do you have another control on your form named ID? If you do then what fills it in?
    Is LastName the name of your ComboBox?
    What is the RecordSource of the ComboBox?

  5. #5
    fun4all is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jun 2012
    Posts
    3
    My form is currently not in datasheet view. I could make it so if needed. There is a text box control on my form named ID. The ID field fill sin the ID text box. LastName is the name of the ComboBox and its row source is the field named LastName.

    Thank You.

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    The RowSource of the LastName ComboBox is probably not the LastName field. My guess is that is the ControlSource of the ComboBox. Are you using the ComboBox to look up existing records in the RecordSource of the Form?

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

Similar Threads

  1. Replies: 1
    Last Post: 04-05-2012, 02:45 PM
  2. Database made on XP won't merge on 7
    By teirrah1995 in forum Import/Export Data
    Replies: 2
    Last Post: 08-06-2011, 02:07 AM
  3. I made my tables and now Im stuck. HELP
    By the extinguisher pro in forum Database Design
    Replies: 7
    Last Post: 06-02-2011, 04:14 PM
  4. List box not reflecting change on a form
    By vladimir.tz in forum Forms
    Replies: 7
    Last Post: 05-06-2010, 03:37 AM
  5. How wizard in access been made
    By miziri in forum Programming
    Replies: 1
    Last Post: 08-20-2009, 03:14 AM

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