VB code

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Dear Sirs
I have a Macro running perfect and it is executing the following:

- billyearlyhelpappendquery
- billhalfyearhelpappendquery
- billsappendquery
- openbillsappendquery
- Print report – billingcemetery
- billingtabledeletequeryquery

I would prefer to do this in VB. I did the following without success:

Private Sub cmdPrintbill_Click()
Dim stDocName As String

stDocName = “billyearlyhelpappendqueryâ€
stDocName = “billhalfyearhelpappendqueryâ€
stDocName = “billsappendqueryâ€
stDocName = “openbillsappendqueryâ€
DoCmd.OpenReport “billingcemeteryâ€, acViewNormal
stDocName = “billingtabledeletequeryqueryâ€

End Sub

I do not get any error message neither is anything shown if I Debug-Compile.
Can anyone alter my VB code so that it is working?
Thanks
Klaus
 
Amateur said:
Dear Sirs
I have a Macro running perfect and it is executing the following:

- billyearlyhelpappendquery
- billhalfyearhelpappendquery
- billsappendquery
- openbillsappendquery
- Print report - billingcemetery
- billingtabledeletequeryquery

I would prefer to do this in VB. I did the following without success:

Private Sub cmdPrintbill_Click()
Dim stDocName As String

stDocName = "billyearlyhelpappendquery"
stDocName = "billhalfyearhelpappendquery"
stDocName = "billsappendquery"
stDocName = "openbillsappendquery"
DoCmd.OpenReport "billingcemetery", acViewNormal
stDocName = "billingtabledeletequeryquery"

End Sub

I do not get any error message neither is anything shown if I
Debug-Compile. Can anyone alter my VB code so that it is working?
Thanks
Klaus

You are merely assigning the name of a query to a variable. You are doing
nothing to make them run. Try the following...

CurrentDB.Execute "billyearlyhelpappendquery", dbFailOnError
CurrentDB.Execute "billhalfyearhelpappendquery", dbFailOnError
CurrentDB.Execute "billsappendquery", dbFailOnError
CurrentDB.Execute "openbillsappendquery", dbFailOnError
DoCmd.OpenReport "billingcemetery", acViewNormal
CurrentDB.Execute "billingtabledeletequeryquery", dbFailOnError
 
Back
Top