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

OpenForm based on criteria 1

Status
Not open for further replies.

spluim

Technical User
May 14, 2003
25
US
I am trying to open a form to display only a record with a matching intRolodex_ID.

This is my coding and it is not working. When I run the code, it does not recognize Temp. I know it is something easy but I surrender

Private Sub Command150_Click()
On Error GoTo Err_Command150_Click

Dim stDocName As String
Dim Temp As Integer

Temp = intRolodex_ID

stDocName = "frmNewPropOwnr"

DoCmd.OpenForm stDocName, acNormal, , "intRolodex_ID = Temp", acFormEdit

Exit_Command150_Click:
Exit Sub

Err_Command150_Click:
MsgBox Err.Description
Resume Exit_Command150_Click
End Sub
 
im having a guess here, but it looks like Temp is one of those reserved words which vba and access use. try altering the variable name to Tempj for instance and see if that works

"My God! It's full of stars...
 
I tried a different word but that didn't do it. I think it is the way I have expression "introlodex_ID = Temp". Should it be presented differently?
 
If you must use Temp, try surrounding it []. It works in VB.Net for naming methods and properties in classes so it's worth a go.

Craig
 
Try:

[tt]DoCmd.OpenForm stDocName, acNormal, , "intRolodex_ID = " & Temp[/tt]

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top