View Full Version : Search opens form/record


Angello Pimental
06-05-2001, 10:34 AM
I have a form which has a wild card search query which brings back results that match what a user has entered in a unbound text box. The results are then listed in a another unbound text box.
The user can then select a match, which prompts another form to open displaying the record he/she wishes to see.

My problem is that I can't get the form that is opened to display the record that the user chose.

Can anyone help? Or even understand what I am trying to do.....

Thnx for any help,

Angelo

[This message has been edited by Angello Pimental (edited 06-05-2001).]

Jack Cowley
06-05-2001, 11:42 AM
I do not know how you are opening the last form, but if you are using the DoCmd.OpenForm method then you can add a 'where' clause that will open the form to the correct record. The code will look something like this:
DoCmd.OpenForm "FormName", , ,"[RecordID] = " & Me.FieldOnForm

Angello Pimental
06-05-2001, 12:38 PM
Thank you for your reply Jack.
I am actually using that piece of code, but still it doesn't want to work for me.....

Here is the code:

Private Sub Listofdomainnames_Click()

On Error GoTo Err_Listofdomainnames_Click

Dim stDocName As String
Dim stLinkCriteria As String


stDocName = "RealForm"
DoCmd.OpenForm stDocName, , , stLinkCriteria
stLinkCriteria = "[Combo77]=" & Me![Listofdomainnames]
Me![Listofdomainnames] = ""
DoCmd.close acForm, "Search"

Exit_Listofdomainnames_Click:
Exit Sub

Err_Listofdomainnames_Click:
MsgBox Err.Description
Resume Exit_Listofdomainnames_Click


End Sub

Can you see anything wrong with my code? Could it be that because I navigate from record to record in my other form by a combobox, that the form won't open to the record I want?

Thanks again for the help....

Angelo

Angello Pimental
06-06-2001, 06:30 AM
I have tried and tried to get this code to work, but I am still having problems.

With the code you mentioned above I get the following Prompt:
-----------------------
Enter Parameter Value
Domainlist
[ ]
-----------------------

Why would it prompt me for a value if the code is stating what the value is !?!

Any help would be great as this is driving me mad!!!!

Thnx