Macro isn't working

J

Jade5

Hello:
Can some one please help me with the following?
I have a Macro that is suppose to print preview a report called Institution
list.

I use a form called Print Reports Dialog Box to select a radio button called
Institution list. When the button is clicked a list called Select Institution
is displayed. The bound field is 1 - Institution ID. When the user clicks an
institution ID in the list and then clicks the Print preview button the info
for the one institution should be displayed but instead when the user clicks
on print preview, they get the following error message:
The Microsoft jet engine does not recognize Forms![Print Reports Dialog
Box]![Select Institution] as a valid field name or expression.

Here is the condition being used in the macro.

=IIf([Forms]![Print Reports Dialog Box]![Select Institution] Is
Null,"","[Institution ID]=Forms![Print Reports Dialog Box]![Select
Institution]")

Is there a syntax error?
Thanks
J
 
O

Ofer

Instead of a macro you can consider running code to run the report,


If IsNull(Me.[Select Institution]) Then
Dim MyWhere as String
MyWhere = "[Institution ID]= " & Me![Select Institution]
docmd.OpenReport "ReportName" ,acViewPreview, , MyWhere
Else
docmd.OpenReport "ReportName" ,acViewPreview
End If

I rather use code, incase of an error it is easier to control it.
 
O

Ofer

Sorry, it should be the other way around

If Not IsNull(Me.[Select Institution]) Then
Dim MyWhere as String
MyWhere = "[Institution ID]= " & Me![Select Institution]
docmd.OpenReport "ReportName" ,acViewPreview, , MyWhere
Else
docmd.OpenReport "ReportName" ,acViewPreview
End If

--
\\// Live Long and Prosper \\//
BS"D


Ofer said:
Instead of a macro you can consider running code to run the report,


If IsNull(Me.[Select Institution]) Then
Dim MyWhere as String
MyWhere = "[Institution ID]= " & Me![Select Institution]
docmd.OpenReport "ReportName" ,acViewPreview, , MyWhere
Else
docmd.OpenReport "ReportName" ,acViewPreview
End If

I rather use code, incase of an error it is easier to control it.

--
\\// Live Long and Prosper \\//
BS"D


Jade5 said:
Hello:
Can some one please help me with the following?
I have a Macro that is suppose to print preview a report called Institution
list.

I use a form called Print Reports Dialog Box to select a radio button called
Institution list. When the button is clicked a list called Select Institution
is displayed. The bound field is 1 - Institution ID. When the user clicks an
institution ID in the list and then clicks the Print preview button the info
for the one institution should be displayed but instead when the user clicks
on print preview, they get the following error message:
The Microsoft jet engine does not recognize Forms![Print Reports Dialog
Box]![Select Institution] as a valid field name or expression.

Here is the condition being used in the macro.

=IIf([Forms]![Print Reports Dialog Box]![Select Institution] Is
Null,"","[Institution ID]=Forms![Print Reports Dialog Box]![Select
Institution]")

Is there a syntax error?
Thanks
J
 
J

Jade5

Thanks Ofer. I'll use code instead.
J.

Ofer said:
Sorry, it should be the other way around

If Not IsNull(Me.[Select Institution]) Then
Dim MyWhere as String
MyWhere = "[Institution ID]= " & Me![Select Institution]
docmd.OpenReport "ReportName" ,acViewPreview, , MyWhere
Else
docmd.OpenReport "ReportName" ,acViewPreview
End If

--
\\// Live Long and Prosper \\//
BS"D


Ofer said:
Instead of a macro you can consider running code to run the report,


If IsNull(Me.[Select Institution]) Then
Dim MyWhere as String
MyWhere = "[Institution ID]= " & Me![Select Institution]
docmd.OpenReport "ReportName" ,acViewPreview, , MyWhere
Else
docmd.OpenReport "ReportName" ,acViewPreview
End If

I rather use code, incase of an error it is easier to control it.

--
\\// Live Long and Prosper \\//
BS"D


Jade5 said:
Hello:
Can some one please help me with the following?
I have a Macro that is suppose to print preview a report called Institution
list.

I use a form called Print Reports Dialog Box to select a radio button called
Institution list. When the button is clicked a list called Select Institution
is displayed. The bound field is 1 - Institution ID. When the user clicks an
institution ID in the list and then clicks the Print preview button the info
for the one institution should be displayed but instead when the user clicks
on print preview, they get the following error message:
The Microsoft jet engine does not recognize Forms![Print Reports Dialog
Box]![Select Institution] as a valid field name or expression.

Here is the condition being used in the macro.

=IIf([Forms]![Print Reports Dialog Box]![Select Institution] Is
Null,"","[Institution ID]=Forms![Print Reports Dialog Box]![Select
Institution]")

Is there a syntax error?
Thanks
J
 

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