macro condition

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am using a condition "not IsNull([LastName])" to open a form. The macro
works in Access 97, Access 2000, but when run in Access2003, the form opens
no matter if last name is blank or not. Any suggestions would be appreciated.
 
John,

I assume [LastName] is the name of a field in the current record of the
form from which the macro is baing triggered? I am not sure why this is
not working for you. But the more usual syntax, in all versions of
Access, would be...
[LastName] Is Not Null

Try it like this, and see if this helps.
 
Steve, thanks, but it still opens the form even when the last name is blank.
I'll try and explain my problem better. I use a form to enter data, after
the last name and first name of the data are entered I trigger a macro
(after_update action). The first part of the macro opens the warning form in
Hidden Window mode then I condition the opening of the same form (uses a
query to compare the name entered with a list of known trouble makers), now
if there is a match of the last name the last name of the query is not null
and a list of people with that last name is displayed, warning the enterer to
notify security. On the other hand if there is no match and the last name is
null the contdition should prevent this warning form from displaying, which
it does in Access 97 and Access 2000, but in 2003 the blank warning form
still displays. I tried your suggestion but it still won't work in 2003.

Steve Schapel said:
John,

I assume [LastName] is the name of a field in the current record of the
form from which the macro is baing triggered? I am not sure why this is
not working for you. But the more usual syntax, in all versions of
Access, would be...
[LastName] Is Not Null

Try it like this, and see if this helps.

--
Steve Schapel, Microsoft Access MVP

I am using a condition "not IsNull([LastName])" to open a form. The macro
works in Access 97, Access 2000, but when run in Access2003, the form opens
no matter if last name is blank or not. Any suggestions would be appreciated.
 
John,

The macro condition you mentioned would refer to the Last Name control
on the form you are using for data entry. It sounds like you are
thinking it will refer to the Last Name in the query, or to the Last
Name in the second (warning) form... am I right? If so, here's an idea,
assuming I understand you correctly... forget opening the form hidden to
start with, and use the equivalent of this as the Condition in your
macro for the OpenForm action...
DCount("*","YourQuery")>0
 
Back
Top