Results 1 to 2 of 2
  1. #1
    roboticsguy1988 is offline Novice
    Windows Vista Access 2007
    Join Date
    Aug 2009
    Posts
    1

    Autofill form fields

    Ok I am new to Access and form programming. Here is what i want to setup.

    I have four fields on a form, Staff Last Name, Staff First Name, Vehicle Owner Last Name, Vehicle Owner First Name.



    I want to have code that does the following.

    On Vehicle Owner Last Name Focus if it is blank autofill it with Staff Last Name.
    On Vehicle Owner First Name Focus if it is blank autofill it with Staff First Name.

    What would be my code to accomplish such a task? Thank you so much in adavance.

  2. #2
    SoftwareMatters is offline Access VBA Developers
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2009
    Location
    Dorset
    Posts
    274
    It depends when you want this to happen. I would do it on the AfterUpdate event of the Staff First/Last Name. It would be something like this:

    Private Sub StaffFirstName_AfterUpdate()
    If IsNull(Me!VehicleFirstName) Then Me!VehicleFirstName = Me!StaffFirstName
    End Sub

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

Similar Threads

  1. Displaying form fields
    By sakthivels in forum Forms
    Replies: 5
    Last Post: 05-25-2009, 07:52 AM
  2. form not displaying fields
    By ashiers in forum Forms
    Replies: 0
    Last Post: 09-19-2008, 07:02 AM
  3. Feeding fields from one form to another
    By dahand in forum Forms
    Replies: 0
    Last Post: 02-15-2008, 01:48 PM
  4. Replies: 1
    Last Post: 01-08-2007, 01:21 PM
  5. Bounding Fields In a Form?
    By tempowls21 in forum Forms
    Replies: 0
    Last Post: 06-22-2006, 06:12 PM

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