Command button in form

A

Alex

I have a command button in a form which opens a new form,
which is linked by test_id.

When i click the command button, I get an error message
saying "syntax error (missing operator) in query
expression '[test_id]='

Does anyone know what is the problem with the code?

The code (which was generated by Access) is:

Private Sub Open_BB_Click()
On Error Go To Err_Open_BB_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "subfrmQA"

stLinkCriteria = "[test_id]=" & Me![test_id]
DoCmd.OpenForm stDocName,acFormDS , , stLinkCriteria

DoCmd.SetWarnings False
DoCmd.OpenQuery "qryAppendAnswers"
[Forms]![subfrmQA].Requery
DoCmd.SetWarnings True

Exit_Open_BB_Click:
Exit Sub

Err_Open_BB_Click:
MsgBox Err.description
Resume Exit_Open_BB_Click
 
M

Marshall Barton

Alex said:
I have a command button in a form which opens a new form,
which is linked by test_id.

When i click the command button, I get an error message
saying "syntax error (missing operator) in query
expression '[test_id]='

Does anyone know what is the problem with the code?

The code (which was generated by Access) is:

Private Sub Open_BB_Click()
On Error Go To Err_Open_BB_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "subfrmQA"

stLinkCriteria = "[test_id]=" & Me![test_id]
DoCmd.OpenForm stDocName,acFormDS , , stLinkCriteria
[]


That message indicates that the test_id texct box does not
have a value. Either you did not enter a value or you
spelled its name incorrectly.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top