How open form to specific record

I want to open a form to a specific record from an onclick event in a command button.  Here is my syntax but it doesn't work,  Can someone help?

docmd.openform "frmIncidentDataNEW",,,"[RecN]='" & me.cboSelectRecord &"'"

Note:  RecN is a number.

--Steve
SteveL13Asked:
Who is Participating?
 
VTKeganConnect With a Mentor Commented:
If RecN is a number you need


DoCmd.OpenForm "frmIncidentDataNEW",,,"[RecN]=" & Me.cboSelectRecord
0
 
VTKeganCommented:
You should only apply the ""s aroung the criteria if RecN is a string (Text)

0
 
Rey Obrero (Capricorn1)Commented:
if the bound column of the combo is not the RecN, you have to specify the column no

DoCmd.OpenForm "frmIncidentDataNEW",,,"[RecN]=" & Me.cboSelectRecord.column(1)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.