Results 1 to 5 of 5
  1. #1
    Lounger
    Join Date
    Aug 2001
    Posts
    33
    Thanks
    0
    Thanked 0 Times in 0 Posts

    retrieving info (2000)

    I am trying to retrieve information from my table regarding a specific record. I want to be able to enter the information required on my form (example: customer's acct. #) and once I hit enter I want it to retrieve all the info. regarding that record. I am able to do this with a combo box. However, I want to have to enter the info. required to bring up that specific record only.

  2. #2
    Star Lounger
    Join Date
    Nov 2001
    Posts
    75
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: retrieving info (2000)

    Are you saying that you do NOT want to select the information from a combo box but type it in to a text box instead? Look at the code created by the combo box that does what you want and modify that code to use the name of the text box instead as that will probably be the easiest way to do it. My only comment would be that I suggest you stick with the combo box as this will show only existing records and avoid any typos, etc., but it is your call....

    hth,
    Jack

  3. #3
    Lounger
    Join Date
    Aug 2001
    Posts
    33
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: retrieving info (2000)

    Thanks, I tried doing what you stated previously (copying the code from the combo box) but the combo box puts the code in the recordsource property and this property does not show up for a text box? So, I put the code in the control source but it would not change the other text boxes on the form to refer to the information selected for that record. Any suggestions?

  4. #4
    Star Lounger
    Join Date
    Nov 2001
    Posts
    75
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: retrieving info (2000)

    If you have an unbound text box named Text1 on your form then code like this in the After Update event of the text box will fill the rest of the fields on the form with the correct data:

    Dim rs As Object

    Set rs = Me.Recordset.Clone
    rs.FindFirst "[AcctID] = " & Me.Text1
    Me.Bookmark = rs.Bookmark

    Change the AcctID to the actual field your are looking for and change Text1 to the actual name of your unbound text box. In this code I have assumed that AcctID is numerical and NOT text. If it is text then the second line should read: rs.FindFirst "[AcctID] = '"& Me.Text1& "'". (Here I have added extra spaces so you can see the proper syntax: rs.FindFirst "[AcctID] = ' " & Me.Text1& " ' ". Do not add the extra spaces.)

    hth,
    Jack

  5. #5
    Lounger
    Join Date
    Aug 2001
    Posts
    33
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: retrieving info (2000)

    Thanks !!! That worked great.

Posting Permissions

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