Hello all
I don't know VBA at all, but I got a piece of code to use for an issue I was having, and I'm not sure if the syntax is correct.
Here's the code:
When I paste this in, the line with [MEDRECNO] is highlighted in red. It also highlights [MEDRECNO] on that line and says Compile Error: "Expected end of statement". Is the syntax correct or should there be quotes removed or added somewhere?
Any advice is greatly appreciated.
thanks
I don't know VBA at all, but I got a piece of code to use for an issue I was having, and I'm not sure if the syntax is correct.
Here's the code:
Code:
Private Sub Combobox1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then '13 is the enter key so the event only occurs when the enter key is pressed
Docmd.openform “OncRegMain”, ,,”[MEDREDNO] = ” & me.Combobox1 'open the form where medrecno matches the record in your combobox assuming medrecno is the bound column of the combobox otherwise refer to its column
Docmd.close acform, me.form.name 'close the search form
End If
End Sub
When I paste this in, the line with [MEDRECNO] is highlighted in red. It also highlights [MEDRECNO] on that line and says Compile Error: "Expected end of statement". Is the syntax correct or should there be quotes removed or added somewhere?
Any advice is greatly appreciated.
thanks