none
Creating a from RRS feed

  • General discussion

  • Okay i have abit of a challange on my hands, i want to create a form with a search field (for customer names / detials) when i select the customer i want to use (generate the form for) it fills out the customers main address, phone number , etc from a table i already have a database with search fields setup and a full functioning customer address book but what i need to do is create another form with ideally a search box so if i surch for example 'David' as my customer and select 'David' it automatically fils 'Davids' details out in the form

    any ideas?

    Regards

    James

    Friday, September 20, 2013 3:31 PM

All replies

  • what i need to do is create another form with ideally a search box so if i surch for example 'David' as my customer and select 'David' it automatically fils 'Davids' details out in the form

    James

    If you are looking to have the search box on the same form, I recommend using a combobox.

    1. Insert an unbound combo box on your Form (search controls in my opinion look better in the header)
    2. Click the ellipsis in the After Update Event for the combobox.
    3. Insert code like the following
    Private Sub YourComboBoxHere_AfterUpdate()
    On Error GoTo YourComboBoxHere_AfterUpdate_Err
    
        DoCmd.SearchForRecord , "", acFirst, "[YourFieldNameToSearchHere] = " & Str(Nz(Screen.ActiveControl, 0))
    
    
    YourComboBoxHere_AfterUpdate_Exit:
        Exit Sub
    
    YourComboBoxHere_AfterUpdate_Err:
        MsgBox Error$
        Resume YourComboBoxHere_AfterUpdate_Exit
    
    End Sub
    

    This will also allow for search as you type or select from the dropdown arrow and keyboarding to the desired record.

    Hth


    Chris Ward

    Monday, September 23, 2013 4:09 PM
  • Good Afternoon James,

    Do you have additional Questions on this?


    Chris Ward

    Tuesday, September 24, 2013 7:30 PM