G
Guest
I do have the following problem:
I would like to combine several commands in SQL with one command button on
my Form.
a) Run an append query to append data to a table
b) Run another append query to append data to the SAME table as in a)
c) Print a report which is based on that table
d) Run a delete query to delete the table
Now I have the following SQL:
****************************
Private Sub Command29_Click()
Dim stDocName As String
Dim strWhere As String
DoCmd.SetWarnings False
stDocName = “yearbillappendâ€
stDocName = “halfyearbillappendâ€
DoCmd.OpenQuery stDocName, acNormal, acEdit
strWhere = “[clientID] = “ & Me.[clientID]
DoCmd.OpenReport “billingâ€, acViewNormal, , strWhere
DoCmd.SetWarnings False
stDocName = “billingtabledeleteâ€
DoCmd.OpenQuery stDocName, acNormal, acEdit
End Sub
****************************
My append queries are showing the correct data. If I run them separately
they are appending to my table correct, and of course I can print the report
and than I can delete my table – That’s if I run everything separate.
If I try SQL, or even if I try to run a Macro the program is doing what it
wants – or the wrong queries are appended, or it not printing a report.
Has anyone an idea how to solve this problem?
I have to say that I need those to append queries appended to that table
because the client has a choice to pay on a yearly basis or by half a year
(anyway I think that’s not so important because those queries are running
correct if I do everything manually).
Thanks for help
Klaus
I would like to combine several commands in SQL with one command button on
my Form.
a) Run an append query to append data to a table
b) Run another append query to append data to the SAME table as in a)
c) Print a report which is based on that table
d) Run a delete query to delete the table
Now I have the following SQL:
****************************
Private Sub Command29_Click()
Dim stDocName As String
Dim strWhere As String
DoCmd.SetWarnings False
stDocName = “yearbillappendâ€
stDocName = “halfyearbillappendâ€
DoCmd.OpenQuery stDocName, acNormal, acEdit
strWhere = “[clientID] = “ & Me.[clientID]
DoCmd.OpenReport “billingâ€, acViewNormal, , strWhere
DoCmd.SetWarnings False
stDocName = “billingtabledeleteâ€
DoCmd.OpenQuery stDocName, acNormal, acEdit
End Sub
****************************
My append queries are showing the correct data. If I run them separately
they are appending to my table correct, and of course I can print the report
and than I can delete my table – That’s if I run everything separate.
If I try SQL, or even if I try to run a Macro the program is doing what it
wants – or the wrong queries are appended, or it not printing a report.
Has anyone an idea how to solve this problem?
I have to say that I need those to append queries appended to that table
because the client has a choice to pay on a yearly basis or by half a year
(anyway I think that’s not so important because those queries are running
correct if I do everything manually).
Thanks for help
Klaus