G
gjameson via AccessMonster.com
I have about 20 or so queries that I need to run at diffrerent times. There
is only one element that changes in each query and it is the same one. I
created a form to select my query. My changing varible is in a ComboBox. Here
is the code behind this query. What is wrong with my syntax? My varible
control is 'cboBook'.
Private Sub btnQuery_Click()
On Error GoTo Err_btnQuery_Click
Dim stLinkCriteria As String
Dim stDocName As String
stDocName = "CustomerLedger"
stLinkCriteria = SELECT Customer.ID, Customer.ABREV_NAME, Customer.
AREA_STS, Customer.MEDIA, Customer.BAN_ROUTE , Customer.CURTAIL_RT, Customer.
MTR_ADDRS, Customer.RN_1_TY_SZ, Customer.CC_RT_NBR , Customer.RUN_1_NMBR
FROM Customer
WHERE (((Customer.ID) < 500000) And ((Customer.ABREV_NAME) <> "ZZZ") And
((Customer.AREA_STS) <> "archive") And ((Customer.MEDIA) = "c") And (
(Customer.BAN_ROUTE) = "cboBook"))
ORDER BY "Customer.CURTAIL_RT";
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_btnQuery_Click:
Exit Sub
Err_btnQuery_Click:
MsgBox Err.Description
Resume Exit_btnQuery_Click
End Sub
Thanks for the help in advance.
Gerald
is only one element that changes in each query and it is the same one. I
created a form to select my query. My changing varible is in a ComboBox. Here
is the code behind this query. What is wrong with my syntax? My varible
control is 'cboBook'.
Private Sub btnQuery_Click()
On Error GoTo Err_btnQuery_Click
Dim stLinkCriteria As String
Dim stDocName As String
stDocName = "CustomerLedger"
stLinkCriteria = SELECT Customer.ID, Customer.ABREV_NAME, Customer.
AREA_STS, Customer.MEDIA, Customer.BAN_ROUTE , Customer.CURTAIL_RT, Customer.
MTR_ADDRS, Customer.RN_1_TY_SZ, Customer.CC_RT_NBR , Customer.RUN_1_NMBR
FROM Customer
WHERE (((Customer.ID) < 500000) And ((Customer.ABREV_NAME) <> "ZZZ") And
((Customer.AREA_STS) <> "archive") And ((Customer.MEDIA) = "c") And (
(Customer.BAN_ROUTE) = "cboBook"))
ORDER BY "Customer.CURTAIL_RT";
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_btnQuery_Click:
Exit Sub
Err_btnQuery_Click:
MsgBox Err.Description
Resume Exit_btnQuery_Click
End Sub
Thanks for the help in advance.
Gerald