Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

List Box to locate client record, then open it in edit mode

Status
Not open for further replies.

Linda354

Technical User
Jan 2, 2002
59
US
I've been trying to use the list box wizard to set up a form that will list all clients entered by a specific counselor, then when I select the client I want, clicking will open the main form in edit mode, calling up that client's record. The wizard creates some code under "AfterUpdate" which sets a variable for the ID I've selected and makes it a bookmark. It looks like I just need the code that would go on and open the form and find the record, but I don't know VB well enough to do that. I'm hitting the wall. Everything I look up for answers, looks like greek to me. My head hurts.
 
This one has many answers or so it seems? I don't use the wizard to populate my list box so without actually creating a fictitious record to see what I get I can't give you an exact answer.

Also, I don't know how you data is stored ? Is it in its own table and linked via a long integer or is it just a name etc... so you see there are many questions and answers to what seems to be a simple question but you could try something on this order.

I would place at the very top of the module the following line

Private strfilter As String

because I allow the user a few choices to give them their results such as double clicking on a name or selecting the name then clicking an OK button I think you get the idea.

now on the click event of the list box I add the following
strfilter = Me("lstCategory") '*this is the name of your list box.
because no matter what they have to click on a name before you act upon it.


now if you want to open via a button or double click you could add something like this *now if your form is based on a table use the table.
DoCmd.OpenForm "frmWhatever", , , "qry_form_is_based_on= " & strfilter

Hope this points you in the correct direction? Life's a journey enjoy the ride...

jazzz
 
After I looked at my suggestion the final line should be
DoCmd.OpenForm "frmWhatever", , , "myfieldname= " & strfilter


Life's a journey enjoy the ride...

jazzz
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top