Susan1
08-09-2000, 10:12 AM
While in form view,, I want to produce a list of names (like a datasheet), so that I can select one from the list, instead of cycling through record by record in the find box. i.e. a list of all Joneses so I can select Tom Jones, etc. I can use a query that requests text input and pops up ONDBLCLICK, but once I have the list, how can I select the name from the list and go directly to that record in form view?
Thanks!
Jack Cowley
08-09-2000, 08:19 PM
If you put the data from the query into a list box you can put code similar to this in the double click event:
DoCmd.OpenForm "FromName", , , "[UniqueID]= " & Me![FieldName].Column(0)
Of course you will need to put your own field names etc. into the code and especially the correct column number.
HTH,
Jack
Susan1
08-19-2000, 07:54 AM
Thanks for your reply Jack. Unfortunately, I still can't get it to work. I can get the list from my query, but I must be inserting the wrong field names. In "FormName", I have inserted the name of the form to jump to after dblclck, which is MAINDB. In "[UniqueID]=" I have inserted the field name which is LAST NAME and in [FieldName].column(0) I have again inserted LAST NAME and then replaced 0 with 1 in the column. Every configuration of this syntax returns "cannot find field name "last name"". The field is there, and I am desparate. Thanks.
Jack Cowley
08-19-2000, 10:04 AM
In the query that you want to display in your List Box here is what you need and in this order:
The persons unique ID number. (For this exercise I will call it UniqueID.)
Their Last Name. (I will call the field LastName.)
Their First Name. (And this field will be FirstName.)
I will assume that the name of your List Box is ListBox for the code below.
Now the code I suggested should look exactly like this:
DoCmd.OpenForm "MAINDB", , , "[UniqueID]= " & Me![ListBox].Column(0)
What this code says is - Open my form named MAINDB to the record where the person has the same UniqueID as the UniqueID in my List Box on this form.....
If this still leaves you confused you can zip and email me your database, assuming it is not too huge or contains sensitive data and I will see if I can get it to work for you.
HTH,
Jack
[This message has been edited by Jack Cowley (edited 08-19-2000).]
xena_morph
08-27-2000, 09:28 AM
hi im trying to do something very similar where i have to input part of a business name, have a subform or whatever appear with results that match and allow me to pick one so that all the details appear in a form that ican then edit, will the same as above apply? would it be possible to have the version youve just made work emailed to me just so ican have an example of how it should be???