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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open Form from data on find form

Status
Not open for further replies.

farmpoor

Technical User
Apr 21, 2004
7
US
I am still learning and have used all of the code for findrecord but I made a query to find a record by FIRSTNAME and LASTNAME fields. I also have an autonumber field ID which is assigned to for identification. Now after I use the find query the form opens and I am trying to allow the user to double click or hit a command button to return to the Input form or the ID I found. I tried the DoCmd for openform but I can not get the where statement to work properly. I have saved the ID as svText but when I use the where command "ID = svText" I just get an object not identified. Is it possible that I need to make sure the text box is a number field because the ID is a number field?

 
Post your code, so others can take a better look at it, and have some better understanding of what's going on.

Stephen [infinity]
"Jesus saith unto him, I am the way, the truth, and the life:
no man cometh unto the Father, but by me." John 14:6 KJV
 
Have you tried to replace this:
"ID = svText"
By this ?
"ID = " & svText

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
At work will get code and post it later also will try the &

 
Hmm, I didn't even see that little snippet - didn't pick it out of paragraph.. I definitely agree w/PHV that you have the wrong format, need the &

Stephen [infinity]
"Jesus saith unto him, I am the way, the truth, and the life:
no man cometh unto the Father, but by me." John 14:6 KJV
 
Here's the code I am trying to use to match the ID find textbox on the find form to open the input form so it can be updated.

Private Sub Text9_DblClick(Cancel As Integer)
On Error GoTo Err_Text9_DblClick

Dim svText As Integer

svText = Text9.Text

DoCmd.Close acForm, "find_F_L", acSave
DoCmd.OpenForm "RECORD", , , "ID = svText", , acFormEdit

'DoCmd.GoToRecord acDataForm, "RECORD", acGoTo, svText

Exit_Text9_DblClick:
Exit Sub

Err_Text9_DblClick:
MsgBox Err.Description
Resume Exit_Text9_DblClick
End Sub


Thanks
 
Have you tried this ?
DoCmd.OpenForm "RECORD", , , "ID = " & svText, , acFormEdit

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
It still doesn't work but I am still trying. The last line of the code
'DoCmd.GoToRecord acDataForm, "RECORD", acGoTo, svText
is currently just a info statement that I use to verify that svText is giving me a number. It will take me to the record number but I can not get it to take me to the ID number.
The ID field is an autonumber field if that makes any difference. I will keep trying thanks.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top