Launch Pop Up on Null Value in field

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

Guest

I want to launch a pop up form I created called 'Reminder' whenever a record
is opened on my Projects form and one or more of 3 fields is null.

The fields are:
Priority
Condition
Category

Having a bit of trouble, so any help would be appreciated. Thanks!
 
Hi Paul

You could use this OnLoad of the form

Private Sub Form_Load()
If Me.Priority = Null Or If Me.Condition = Null Or If Me.Category = Null Or
Then
DoCmd.OpenForm "Reminder", acNormal, "", "", , acNormal
End If
End Sub

Hope this helps
 
Or use this

Private Sub Form_Open(Cancel As Integer)
If IsNull(Me.Priority Or Me.Condition Or Me.Category) Then
DoCmd.OpenForm "Reminder", acNormal, "", "", , acNormal
End If
End Sub

Think this looks a little cleaner
 
Wayne, this is partly working.

If I write it as you have shown, I get an error:
Runtime Error '13': Type Mismatch

If I go into Debug, the line below is highlighted:
If IsNull(Me.Priority Or Me.Condition Or Me.Category) Then

However, if I limit it to checking just one of the fields, i.e.,
Me.Priority, it works fine.

I think it may have to do with how to handle it if there IS in fact a value
populated in the field so it is NOT Null.

Do you agree? So if the value is NOT Null, then how should I bypass it and
keep going?

Thanks!
 
Hi Paul

I just set up a small table and form to copy the code and run it and it
works fine.

Are the fields Priority, Condition and Category all text fields - number
fields or a mixture
 
On the form, these are all combo boxes.

The data populating them is text, and it is querying the options available
in the combo box from an associated table that holds the values with two
fields, one a text field and one a number field. The number field is just
used for sorting purposes, the text field is what is displayed in the combo
box.

Thanks
 
Oh and have you checked the field names and the control names ??

The field name is the names of the field in the table
The control name is the name of the control on the form that is linked
(sourced) to the table field.

Is the "Control names" that are used in the code.

Open the properties box and check the names in the "other" column.
 
Have you checked the bound column is text - but on thinking about it it
should not really make any difference. The control is either null or Not -
if it is null the code should trip if not then nothing will happen.
 
Well I am lost then. It works for me but not for you. We must be doing
something different.

try each of these in turn and make sure they all work

If IsNull(Me.Priority) Then

If IsNull(Me.Category) Then

If IsNull(Me.Condition) Then
 
Wayne,

No problems there, so I'm not sure what's going on either...obviously
something on my end.

The purpose of this was to remind users to update these fields because they
were new fields added when we switched to a new database and design. However,
I realized that I had default populated 2 of these fields and to be sure, I
ran a couple quick queries to validate that the only one of these 3 fields
that could be and was null was the Category field. Therefore, I simply
included the check only on that field and everything will work fine that way.

Thanks very much for your help!
 
Paul,

Not sure if this is the problem but Wayne's original post has an extra "OR"
at the end of the If statement.

Sprinks
 
ooops. yes you are right. I think paul was using the second option.

Sorry about the paul, Sprinks is correct - I should my posts more carefully.

Private Sub Form_Load()
If Me.Priority = Null Or If Me.Condition = Null Or If Me.Category = Null Or
Then
DoCmd.OpenForm "Reminder", acNormal, "", "", , acNormal
End If
End Sub


Should be


Private Sub Form_Load()
If Me.Priority = Null Or If Me.Condition = Null Or If Me.Category = Null Then
DoCmd.OpenForm "Reminder", acNormal, "", "", , acNormal
End If
End Sub

Note the removed "Or" between the Null and Then
 

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

Back
Top