Open Report command not working 
Author Message
 Open Report command not working

Hi All,
Ive been trying to create an event procedure that does the
folowing: There is a combo box named "Recipient"- with a
list of names, it is on a subform named "sfrm Search by
Recipient", When someone clicks on a command button
button, the report named "rptLog by Recipient" should be
opened and should return only the name the user has
selected in the combo box.
Here is what I have so far:

Private Sub Command4_Click()
    Dim strDocName As String
    strDocName = "rptKK Fax Log by Recipient"

        On Error Resume Next
    DoCmd.OpenReport strDocName,
acViewPreview, , , "Recipient = " & Me!Recipient

 End Sub

When I run this I am getting this error:  "Compile Error-
Wrong number of arguments or invalid property assignment"  
Am I missing something? Please respond if you can,



Sun, 10 Oct 2004 05:18:47 GMT  
 Open Report command not working
On Tue, 23 Apr 2002 14:18:47 -0700, "RL"

Quote:

>Hi All,
>Ive been trying to create an event procedure that does the
>folowing: There is a combo box named "Recipient"- with a
>list of names, it is on a subform named "sfrm Search by
>Recipient", When someone clicks on a command button
>button, the report named "rptLog by Recipient" should be
>opened and should return only the name the user has
>selected in the combo box.
>Here is what I have so far:

>Private Sub Command4_Click()
>    Dim strDocName As String
>    strDocName = "rptKK Fax Log by Recipient"

>        On Error Resume Next
>    DoCmd.OpenReport strDocName,
>acViewPreview, , , "Recipient = " & Me!Recipient

> End Sub

>When I run this I am getting this error:  "Compile Error-
>Wrong number of arguments or invalid property assignment"  
>Am I missing something? Please respond if you can,

You have an extra comma.  If the Recipient field is a text
field, then you also need to enclose the combobox's value in
quotes.
        . . .
acViewPreview, , "Recipient = """ & Me!Recipient & """"

You never said whether this code is in the sub form or in
the main form.  If the code is in the main form, you need to
use [sfrm Search by Recipient].Form!Recipient instead of
Me!Recipient

--
Marsh
MVP [MS Access]



Sun, 10 Oct 2004 13:03:06 GMT  
 Open Report command not working
Thanks so much.
Quote:
>-----Original Message-----
>On Tue, 23 Apr 2002 14:18:47 -0700, "RL"

>>Hi All,
>>Ive been trying to create an event procedure that does
the
>>folowing: There is a combo box named "Recipient"- with a
>>list of names, it is on a subform named "sfrm Search by
>>Recipient", When someone clicks on a command button
>>button, the report named "rptLog by Recipient" should be
>>opened and should return only the name the user has
>>selected in the combo box.
>>Here is what I have so far:

>>Private Sub Command4_Click()
>>    Dim strDocName As String
>>    strDocName = "rptKK Fax Log by Recipient"

>>        On Error Resume Next
>>    DoCmd.OpenReport strDocName,
>>acViewPreview, , , "Recipient = " & Me!Recipient

>> End Sub

>>When I run this I am getting this error:  "Compile Error-
>>Wrong number of arguments or invalid property
assignment"  
>>Am I missing something? Please respond if you can,

>You have an extra comma.  If the Recipient field is a text
>field, then you also need to enclose the combobox's value
in
>quotes.
>    . . .
>acViewPreview, , "Recipient = """ & Me!Recipient & """"

>You never said whether this code is in the sub form or in
>the main form.  If the code is in the main form, you need
to
>use [sfrm Search by Recipient].Form!Recipient instead of
>Me!Recipient

>--
>Marsh
>MVP [MS Access]
>.



Mon, 11 Oct 2004 04:12:28 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Report works in Crystal Reports but not in CRViewer

2. SendObject command not working properly with Outlook Express

3. Command Bar Button .OnAction Property not working...

4. Replace command not working

5. Find command not working

6. ChDir Command Not Working

7. Enabling command bar buttons based on doc open or not

8. ADO SP ReturnValue Params not working and problems with Command.Append

9. Shell command not working...Please help

10. Will Move command not working as expected

11. Shell command not working...NEED HELP!!!!

12. sheez simple mousepointer command does not work

 

 
Powered by phpBB® Forum Software