A
andreas.strzodka
Hello,
I created a form to download debit transactions using a multiselect of
accounts and a date range.
Everything works dandy. The code is:
Private Sub run_download_request_Click()
On Error GoTo Err_Handler
Dim varItem As Variant
Dim strCriteria As String
Dim strSQL As String
For Each varItem In Me!Country.ItemsSelected
strCriteria = strCriteria & "fpmcapshist_fpmrequest.senderaba =" &
Chr(34) & Me!Country.ItemData(varItem) & Chr(34) & " And
((FPMCAPSHIST_FPMREQUEST.APPLICATIONCYCLEDATE) Between
forms.Download_Selection_request.Start_Date And
Forms.Download_Selection_request.End_Date) " & " OR "
Next varItem
strCriteria = Left(strCriteria, Len(strCriteria) - 3)
strSQL = "SELECT FPMCAPSHIST_FPMREQUEST.SENDERABA,
FPMCAPSHIST_FPMREQUEST.APPLICATIONCYCLEDATE,
FPMCAPSHIST_FPMREQUEST.RECEIVERABA,
FPMCAPSHIST_FPMREQUEST.RECEIVERNAME,
FPMCAPSHIST_FPMREQUEST.CUSTOMPROPERTY1,
fpmcapshist_fpmrequestdata.data,fpmcapshist_fpmrequest.sendername INTO
FPMRequest_DownloadTable " & _
"FROM FPMCAPSHIST_FPMREQUEST INNER JOIN
FPMCAPSHIST_FPMREQUESTDATA ON
(FPMCAPSHIST_FPMREQUEST.APPLICATIONCYCLEDATE =
FPMCAPSHIST_FPMREQUESTDATA.APPLICATIONCYCLEDATE) AND
(FPMCAPSHIST_FPMREQUEST.INPUTID =
FPMCAPSHIST_FPMREQUESTDATA.REQUEST_INPUTID)" & _
"WHERE " & strCriteria
CurrentDb.QueryDefs("FPMRequest_Download").SQL = strSQL
DoCmd.OpenQuery "FPMrequest_Download"
Exit_Handler:
Exit Sub
Err_Handler:
MsgBox Err.Number & " " & Err.Description
Resume Exit_Handler
End Sub
Now, I want to use a second form to do the same thing, just for the
credits. the code for that form looks somewhat like this:
Private Sub run_download_notification_Click()
On Error GoTo Err_Handler
Dim varItem As Variant
Dim strCriteria As String
Dim strSQL As String
For Each varItem In Me!Country.ItemsSelected
strCriteria = strCriteria & "fpmcapshist_fpmnotification.receiveraba ="
& Chr(34) & Me!Country.ItemData(varItem) & Chr(34) & " And
((FPMCAPSHIST_FPMnotification.APPLICATIONCYCLEDATE) Between
forms.Download_Selection_notification.Start_Date And
Forms.Download_Selection_notification.End_Date) " & " OR "
Next varItem
strCriteria = Left(strCriteria, Len(strCriteria) - 3)
Me!Account_select = strCriteria
strSQL = "SELECT FPMCAPSHIST_FPMNOTIFICATION.RECEIVERABA,
FPMCAPSHIST_FPMNOTIFICATION.APPLICATIONCYCLEDATE,
FPMCAPSHIST_FPMNOTIFICATION.CUSTOMPROPERTY1,
FPMCAPSHIST_FPMNOTIFICATION.SENDERABA,
FPMCAPSHIST_FPMNOTIFICATION.RECEIVERNAME,
FPMCAPSHIST_FPMNOTIFICATIONDATA.DATA INTO
FPMNotification_DownloadTable" & _
"FROM FPMCAPSHIST_FPMNOTIFICATION INNER JOIN
FPMCAPSHIST_FPMNOTIFICATIONDATA ON (FPMCAPSHIST_FPMNOTIFICATION.INPUTID
= FPMCAPSHIST_FPMNOTIFICATIONDATA.NOTIFICATION_INPUTID) AND
(FPMCAPSHIST_FPMNOTIFICATION.APPLICATIONCYCLEDATE =
FPMCAPSHIST_FPMNOTIFICATIONDATA.APPLICATIONCYCLEDATE) " & _
"WHERE " & strCriteria
CurrentDb.QueryDefs("FPMNotification_Download").SQL = strSQL
DoCmd.OpenQuery "FPMNotification_Download"
Exit_Handler:
Exit Sub
Err_Handler:
MsgBox Err.Number & " " & Err.Description
Resume Exit_Handler
End Sub
When I run this code, the error message "Query Input must contain at
least one table or query" comes up. Any ideas on why this would be the
case?
Thanks in advance.
Andreas
I created a form to download debit transactions using a multiselect of
accounts and a date range.
Everything works dandy. The code is:
Private Sub run_download_request_Click()
On Error GoTo Err_Handler
Dim varItem As Variant
Dim strCriteria As String
Dim strSQL As String
For Each varItem In Me!Country.ItemsSelected
strCriteria = strCriteria & "fpmcapshist_fpmrequest.senderaba =" &
Chr(34) & Me!Country.ItemData(varItem) & Chr(34) & " And
((FPMCAPSHIST_FPMREQUEST.APPLICATIONCYCLEDATE) Between
forms.Download_Selection_request.Start_Date And
Forms.Download_Selection_request.End_Date) " & " OR "
Next varItem
strCriteria = Left(strCriteria, Len(strCriteria) - 3)
strSQL = "SELECT FPMCAPSHIST_FPMREQUEST.SENDERABA,
FPMCAPSHIST_FPMREQUEST.APPLICATIONCYCLEDATE,
FPMCAPSHIST_FPMREQUEST.RECEIVERABA,
FPMCAPSHIST_FPMREQUEST.RECEIVERNAME,
FPMCAPSHIST_FPMREQUEST.CUSTOMPROPERTY1,
fpmcapshist_fpmrequestdata.data,fpmcapshist_fpmrequest.sendername INTO
FPMRequest_DownloadTable " & _
"FROM FPMCAPSHIST_FPMREQUEST INNER JOIN
FPMCAPSHIST_FPMREQUESTDATA ON
(FPMCAPSHIST_FPMREQUEST.APPLICATIONCYCLEDATE =
FPMCAPSHIST_FPMREQUESTDATA.APPLICATIONCYCLEDATE) AND
(FPMCAPSHIST_FPMREQUEST.INPUTID =
FPMCAPSHIST_FPMREQUESTDATA.REQUEST_INPUTID)" & _
"WHERE " & strCriteria
CurrentDb.QueryDefs("FPMRequest_Download").SQL = strSQL
DoCmd.OpenQuery "FPMrequest_Download"
Exit_Handler:
Exit Sub
Err_Handler:
MsgBox Err.Number & " " & Err.Description
Resume Exit_Handler
End Sub
Now, I want to use a second form to do the same thing, just for the
credits. the code for that form looks somewhat like this:
Private Sub run_download_notification_Click()
On Error GoTo Err_Handler
Dim varItem As Variant
Dim strCriteria As String
Dim strSQL As String
For Each varItem In Me!Country.ItemsSelected
strCriteria = strCriteria & "fpmcapshist_fpmnotification.receiveraba ="
& Chr(34) & Me!Country.ItemData(varItem) & Chr(34) & " And
((FPMCAPSHIST_FPMnotification.APPLICATIONCYCLEDATE) Between
forms.Download_Selection_notification.Start_Date And
Forms.Download_Selection_notification.End_Date) " & " OR "
Next varItem
strCriteria = Left(strCriteria, Len(strCriteria) - 3)
Me!Account_select = strCriteria
strSQL = "SELECT FPMCAPSHIST_FPMNOTIFICATION.RECEIVERABA,
FPMCAPSHIST_FPMNOTIFICATION.APPLICATIONCYCLEDATE,
FPMCAPSHIST_FPMNOTIFICATION.CUSTOMPROPERTY1,
FPMCAPSHIST_FPMNOTIFICATION.SENDERABA,
FPMCAPSHIST_FPMNOTIFICATION.RECEIVERNAME,
FPMCAPSHIST_FPMNOTIFICATIONDATA.DATA INTO
FPMNotification_DownloadTable" & _
"FROM FPMCAPSHIST_FPMNOTIFICATION INNER JOIN
FPMCAPSHIST_FPMNOTIFICATIONDATA ON (FPMCAPSHIST_FPMNOTIFICATION.INPUTID
= FPMCAPSHIST_FPMNOTIFICATIONDATA.NOTIFICATION_INPUTID) AND
(FPMCAPSHIST_FPMNOTIFICATION.APPLICATIONCYCLEDATE =
FPMCAPSHIST_FPMNOTIFICATIONDATA.APPLICATIONCYCLEDATE) " & _
"WHERE " & strCriteria
CurrentDb.QueryDefs("FPMNotification_Download").SQL = strSQL
DoCmd.OpenQuery "FPMNotification_Download"
Exit_Handler:
Exit Sub
Err_Handler:
MsgBox Err.Number & " " & Err.Description
Resume Exit_Handler
End Sub
When I run this code, the error message "Query Input must contain at
least one table or query" comes up. Any ideas on why this would be the
case?
Thanks in advance.
Andreas