Search button to populate information

Discussion in 'Microsoft Access Forms' started by yomi m via AccessMonster.com, Jul 28, 2005.

  1. Okay i seriously need some quick help. I have an unbound text box
    (txtContact) that phone number are entered into. When i hit the command
    button (cmdSearch) i want to open a new form (Search Numbers), and have the
    fields name and organization combo boxes to reflect the data based on
    thephone number. i have a query that is based off a main table. i want the
    search command button to read the query, find the phone number, and input a
    name and org into the designated fields assigned to the number. I have been
    trying to figure this out for weeks, what will the code be behind the search
    button?


    --
    Message posted via http://www.accessmonster.com
     
    yomi m via AccessMonster.com, Jul 28, 2005
    #1
    1. Advertisements

  2. yomi m via AccessMonster.com

    Guest Guest

    hi,
    you could use DLookup.

    Me.txtname = DLookup("[name]", "yourtabel", "[PhoneNum] = '" &
    [Forms]![yourfirstform]![txtphonenum] & "'")

    note: this wrapped. should be one line

    I've used this technique many time to populate a form. you would need a
    DLookup of each text box you want to populate.

    regards
    FSt1
    "yomi m via AccessMonster.com" wrote:

    >
    > Okay i seriously need some quick help. I have an unbound text box
    > (txtContact) that phone number are entered into. When i hit the command
    > button (cmdSearch) i want to open a new form (Search Numbers), and have the
    > fields name and organization combo boxes to reflect the data based on
    > thephone number. i have a query that is based off a main table. i want the
    > search command button to read the query, find the phone number, and input a
    > name and org into the designated fields assigned to the number. I have been
    > trying to figure this out for weeks, what will the code be behind the search
    > button?
    >
    >
    > --
    > Message posted via http://www.accessmonster.com
    >
     
    Guest, Jul 28, 2005
    #2
    1. Advertisements

  3. okay where do i put the d lookup statement. I want the form to look up
    (Contact Number) on a query called (Customer Info), and send (Contact Name)
    and (Organization) found into the (cmbName) and (cmb Organization) text boxes.


    FSt1 wrote:
    >hi,
    >you could use DLookup.
    >
    >Me.txtname = DLookup("[name]", "yourtabel", "[PhoneNum] = '" &
    >[Forms]![yourfirstform]![txtphonenum] & "'")
    >
    >note: this wrapped. should be one line
    >
    >I've used this technique many time to populate a form. you would need a
    >DLookup of each text box you want to populate.
    >
    >regards
    >FSt1
    >
    >> Okay i seriously need some quick help. I have an unbound text box
    >> (txtContact) that phone number are entered into. When i hit the command

    >[quoted text clipped - 5 lines]
    >> trying to figure this out for weeks, what will the code be behind the search
    >> button?



    --
    Message posted via http://www.accessmonster.com
     
    yomi m via AccessMonster.com, Jul 28, 2005
    #3
  4. yomi m via AccessMonster.com

    Guest Guest

    hi,
    if you use DLookup, the form will not lookup anything in the query. DLookup
    goes streight to the table to get the info. that is why you need a DLookup
    statement for each data bit you want.
    Form what you just posted, you will need 2 DLookup Statements. 1 for contact
    Name and 1 for organization.

    Me.cmbname = DLookup("[Contact name]", "yourTable", "[contact] = '" &
    [Forms]![yourform]![txtcontact] & "'")

    I adjusted the Dlookup statement a little but you will still have to plug in
    some correct names.
    the statement read something like this...
    return field1 from record in table1 where field2 matched textbox1
    also lookup to Dlookup in access help

    you could put both in the contact text box's afterupdate event or somewere
    in the cmdSearch button code.

    Regards

    FSt1

    "yomi m via AccessMonster.com" wrote:

    >
    > okay where do i put the d lookup statement. I want the form to look up
    > (Contact Number) on a query called (Customer Info), and send (Contact Name)
    > and (Organization) found into the (cmbName) and (cmb Organization) text boxes.
    >
    >
    > FSt1 wrote:
    > >hi,
    > >you could use DLookup.
    > >
    > >Me.txtname = DLookup("[name]", "yourtabel", "[PhoneNum] = '" &
    > >[Forms]![yourfirstform]![txtphonenum] & "'")
    > >
    > >note: this wrapped. should be one line
    > >
    > >I've used this technique many time to populate a form. you would need a
    > >DLookup of each text box you want to populate.
    > >
    > >regards
    > >FSt1
    > >
    > >> Okay i seriously need some quick help. I have an unbound text box
    > >> (txtContact) that phone number are entered into. When i hit the command

    > >[quoted text clipped - 5 lines]
    > >> trying to figure this out for weeks, what will the code be behind the search
    > >> button?

    >
    >
    > --
    > Message posted via http://www.accessmonster.com
    >
     
    Guest, Jul 28, 2005
    #4
  5. thanks, i'll try that to see what happens

    FSt1 wrote:
    >hi,
    >if you use DLookup, the form will not lookup anything in the query. DLookup
    >goes streight to the table to get the info. that is why you need a DLookup
    >statement for each data bit you want.
    >Form what you just posted, you will need 2 DLookup Statements. 1 for contact
    >Name and 1 for organization.
    >
    >Me.cmbname = DLookup("[Contact name]", "yourTable", "[contact] = '" &
    >[Forms]![yourform]![txtcontact] & "'")
    >
    >I adjusted the Dlookup statement a little but you will still have to plug in
    >some correct names.
    >the statement read something like this...
    >return field1 from record in table1 where field2 matched textbox1
    >also lookup to Dlookup in access help
    >
    >you could put both in the contact text box's afterupdate event or somewere
    >in the cmdSearch button code.
    >
    >Regards
    >
    >FSt1
    >
    >> okay where do i put the d lookup statement. I want the form to look up
    >> (Contact Number) on a query called (Customer Info), and send (Contact Name)

    >[quoted text clipped - 19 lines]
    >> >> trying to figure this out for weeks, what will the code be behind the search
    >> >> button?



    --
    Message posted via http://www.accessmonster.com
     
    yomi m via AccessMonster.com, Jul 28, 2005
    #5
  6. what is "[contact] . Do i replace with muyown input?

    FSt1 wrote:
    >hi,
    >if you use DLookup, the form will not lookup anything in the query. DLookup
    >goes streight to the table to get the info. that is why you need a DLookup
    >statement for each data bit you want.
    >Form what you just posted, you will need 2 DLookup Statements. 1 for contact
    >Name and 1 for organization.
    >
    >Me.cmbname = DLookup("[Contact name]", "yourTable", "[contact] = '" &
    >[Forms]![yourform]![txtcontact] & "'")
    >
    >I adjusted the Dlookup statement a little but you will still have to plug in
    >some correct names.
    >the statement read something like this...
    >return field1 from record in table1 where field2 matched textbox1
    >also lookup to Dlookup in access help
    >
    >you could put both in the contact text box's afterupdate event or somewere
    >in the cmdSearch button code.
    >
    >Regards
    >
    >FSt1
    >
    >> okay where do i put the d lookup statement. I want the form to look up
    >> (Contact Number) on a query called (Customer Info), and send (Contact Name)

    >[quoted text clipped - 19 lines]
    >> >> trying to figure this out for weeks, what will the code be behind the search
    >> >> button?



    --
    Message posted via http://www.accessmonster.com
     
    yomi m via AccessMonster.com, Jul 28, 2005
    #6
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. davis1189

    Auto populate Record information in form

    davis1189, Sep 4, 2003, in forum: Microsoft Access Forms
    Replies:
    2
    Views:
    249
    Jeremiah Ellison
    Sep 4, 2003
  2. Guest

    Populate fields on click event of button

    Guest, Dec 30, 2003, in forum: Microsoft Access Forms
    Replies:
    1
    Views:
    557
    Allen Browne
    Dec 30, 2003
  3. Guest
    Replies:
    2
    Views:
    182
    Guest
    Jul 28, 2005
  4. Guest

    populate information that has already been entered.

    Guest, Jun 19, 2006, in forum: Microsoft Access Forms
    Replies:
    5
    Views:
    234
    samisiddiqui
    May 10, 2008
  5. Use command button to populate subform Tab

    , Sep 27, 2006, in forum: Microsoft Access Forms
    Replies:
    2
    Views:
    194
Loading...

Share This Page