Compile Error - Argument Not Optional

  • Thread starter Thread starter Tal
  • Start date Start date
T

Tal

I am trying to code a command button to do all sorts of things at once, as
follows:

Private Sub btnPrintReceipt_Click()
DoCmd.SetWarnings False
DoCmd.OpenQuery.qryDonorAddressTotalUnreceiptedCZCADonations (This runs an
append query that generates the Receipt.)
DoCmd.OpenQuery.uqryAssignIssueDateCZCA (This runs an update query that adds
today's date to the Receipt)
DoCmd.OpenReport.rptCZCAReceipts (This opens the Receipt)
DoCmd.SetWarnings True
End Sub

I am getting a Compile Error - Argument Not Optional error and the highlight
is appearing on the Append query line.

Help please!!

Many thanks,
Talia
 
Your syntax is wrong by using the dot operator in all your DoCmd statements
It should be
DoCmd.OpenQuery "qryDonorAddressTotalUnreceiptedCZCADonations"
 
I think Dennis that I should win the
"Duh!!!" award for the day.
I have written these commands a bigillion times and yet I was getting all
caught up in whether it had something to do with the append query etc.
Thank you so much.
I would never have seen something so unbelievably obvious.
And thank you for your patience with such a "Duh!!" question.

Cheers,
Talia
 
Back
Top