Stop print preview IIF...

B

Bonnie

Hi all! Using A02 on XP. Have a report that I would like
to do this with: If any of the records in my query
[qAssignedTo] have the field [Tech]="XXX", pop a message
box and cancel print preview. I can do the msgbox and
cancel but not sure of the wordage on the If line. Is that
a recordset type of command?

Thanks in advance for any help and advice!
 
A

Allen Browne

Use the Open event procedure of the report to check for the unacceptable
data:

Private Sub Report_Open(Cancel As Integer)
If Not IsNull(DLookup("Tech", "qAssignedTo", "Tech = ""XXX""")) Then
Cancel = True
Msgbox "Canceled for Tech XXX."
End If
End Sub
 
B

Bonnie

You are GREAT! (and fast!) I'm just moving into the arena
of event procedures and lovin' learnin'. Exactly what I
needed. DLookup is good stuff but confusing.

Thank you VERY much for the time you put into helping
folks like me, it is appreciated.
-----Original Message-----
Use the Open event procedure of the report to check for the unacceptable
data:

Private Sub Report_Open(Cancel As Integer)
If Not IsNull(DLookup("Tech", "qAssignedTo", "Tech = ""XXX""")) Then
Cancel = True
Msgbox "Canceled for Tech XXX."
End If
End Sub

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Hi all! Using A02 on XP. Have a report that I would like
to do this with: If any of the records in my query
[qAssignedTo] have the field [Tech]="XXX", pop a message
box and cancel print preview. I can do the msgbox and
cancel but not sure of the wordage on the If line. Is that
a recordset type of command?

Thanks in advance for any help and advice!


.
 
A

Allen Browne

Yes, DLookup() can be confusing.

There is an explanation in this article:
Getting a value from a table: DLookup()
at:
http://members.iinet.net.au/~allenbrowne/casu-07.html
HTH

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Bonnie said:
You are GREAT! (and fast!) I'm just moving into the arena
of event procedures and lovin' learnin'. Exactly what I
needed. DLookup is good stuff but confusing.

Thank you VERY much for the time you put into helping
folks like me, it is appreciated.
-----Original Message-----
Use the Open event procedure of the report to check for the unacceptable
data:

Private Sub Report_Open(Cancel As Integer)
If Not IsNull(DLookup("Tech", "qAssignedTo", "Tech = ""XXX""")) Then
Cancel = True
Msgbox "Canceled for Tech XXX."
End If
End Sub


Hi all! Using A02 on XP. Have a report that I would like
to do this with: If any of the records in my query
[qAssignedTo] have the field [Tech]="XXX", pop a message
box and cancel print preview. I can do the msgbox and
cancel but not sure of the wordage on the If line. Is that
a recordset type of command?

Thanks in advance for any help and advice!
 

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