Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2009

    Unanswered: 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
    Join Date
    Mar 2009
    Provided Answers: 15
    Private Sub OwnerLastName_GotFocus()
        If IsNull(Me.OwnerLastName.Value) Then Me.OwnerLastName.Value = Me.StaffLastName.Value
    End Sub
    Private Sub OwnerFirstName_GotFocus()
        If IsNull(Me.OwnerFirstName.Value) Then Me.OwnerFirstName.Value = Me.StaffFirstName.Value
    End Sub
    Have a nice day!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts