W
westaj
I have a query named [qryStudyAllInterested]. There are no criteria for this
query, it is used to combine two tables into one query. I have created a form
named [frmStudyAllInterestedSelect] that has one button named
[btnStudyAllInterested] and one lookup field named [cbxStudyID] that does not
have a control source.
I would like to select a study from a drop down list using the [cbxStudyID]
field. Then press the [btnStudyAllInterested] button. Upon pressing this
button I would like Access to open a different form named
[frmStudyAllInterested] that is in tabular view and linked (record source) to
the [qryStudyAllInterested] query.
I have written VBA code (see what follows). But when I select a study from
the [cbxStudyID] drop box and then click on the [btnStudyAllInterested]
button I receive the following error.
"Syntax error (missing operator) in query expression '[StudyID]= "the value
selected in the [cbxSudyID] drop box displays here"'"
PLEASE HELP.
VBA programmed to the button [btnStudyAllInterested]:
Private Sub btnStudyAllInterested_Click()
On Error GoTo Err_FilterIssues_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmStudyAllInterested"
stLinkCriteria = "[StudyID]=" & cbxStudyID
If DCount("StudyID", "qryStudyAllInterested", stLinkCriteria) Then
DoCmd.OpenForm stDocName, , , stLinkCriteria
' Close the dialog box.
DoCmd.Close acForm, "frmStudyAllInterestedSelect"
End If
Exit_btnStudyAllInterested_Click:
Exit Sub
Err_FilterIssues_Click:
MsgBox Err.Description
Resume Exit_btnStudyAllInterested_Click
End Sub
query, it is used to combine two tables into one query. I have created a form
named [frmStudyAllInterestedSelect] that has one button named
[btnStudyAllInterested] and one lookup field named [cbxStudyID] that does not
have a control source.
I would like to select a study from a drop down list using the [cbxStudyID]
field. Then press the [btnStudyAllInterested] button. Upon pressing this
button I would like Access to open a different form named
[frmStudyAllInterested] that is in tabular view and linked (record source) to
the [qryStudyAllInterested] query.
I have written VBA code (see what follows). But when I select a study from
the [cbxStudyID] drop box and then click on the [btnStudyAllInterested]
button I receive the following error.
"Syntax error (missing operator) in query expression '[StudyID]= "the value
selected in the [cbxSudyID] drop box displays here"'"
PLEASE HELP.
VBA programmed to the button [btnStudyAllInterested]:
Private Sub btnStudyAllInterested_Click()
On Error GoTo Err_FilterIssues_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmStudyAllInterested"
stLinkCriteria = "[StudyID]=" & cbxStudyID
If DCount("StudyID", "qryStudyAllInterested", stLinkCriteria) Then
DoCmd.OpenForm stDocName, , , stLinkCriteria
' Close the dialog box.
DoCmd.Close acForm, "frmStudyAllInterestedSelect"
End If
Exit_btnStudyAllInterested_Click:
Exit Sub
Err_FilterIssues_Click:
MsgBox Err.Description
Resume Exit_btnStudyAllInterested_Click
End Sub