Invalid Argument when trying to print current record.

  • Thread starter Another_Access_Dummy
  • Start date
A

Another_Access_Dummy

This code was working fine until I created my second version.

Private Sub cmdPrintRecord_Click()
On Error GoTo Err_cmdPrintRecord_Click

Me.Refresh ' this saves the data to disk
DoCmd.OpenReport "Current Call Record", acViewPreview, , "CallID =
" & Me!CallID



Exit_cmdPrintRecord_Click:
Exit Sub

Err_cmdPrintRecord_Click:
MsgBox Err.Description
Resume Exit_cmdPrintRecord_Click

End Sub

It prints the current call record that my user is on. I did add some
new fields and new formatting to the report itself, but I don't see why
that could be the problem.

In the Immediate window, I get this when I run the code:

Compile error: argument not optional.

If I just click on the Print button on the form - I get Invalid
Argument.

Any suggestions?

Thanks.
 
M

missinglinq via AccessMonster.com

The argument they're refering to (that you left blank) is the third argue in
the OpenReport command, filtername. From Access Help:

filtername: A string expression that's the valid name of a query in the
current database

This is apprently not an optional argument, so you need to enter an argument
there.

BTW, Me. Refresh does not save data to disk! It refreshes the your view of
the RecordSource, which is to say in a multi-user environment it update's
your view to reflect changes made by other users during your session.
 

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