Compile Error - Argument Not Optional

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
 
D

Dennis

Your syntax is wrong by using the dot operator in all your DoCmd statements
It should be
DoCmd.OpenQuery "qryDonorAddressTotalUnreceiptedCZCADonations"
 
T

Tal

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top