Null

  • Thread starter Thread starter MsWatts
  • Start date Start date
M

MsWatts

Is there a way to skip form fields if the text box contains a null value and
run without that info? If so could someone provide an example code please?

Thanks!
 
Is there a way to skip form fields if the text box contains a null value and
run without that info? If so could someone provide an example code please?

Thanks!

What are you trying to "run"?

Certainly you can leave a textbox Null on a Form, unless the field is required
in the table or you have validation code which is checking for a specific
value. You don't need any "code" to allow nulls - in fact you need to take
some action to *prohibit* nulls!

What specific problem or error message are you getting?
 
I'm not getting an error. The issue I am having is if I try to use my form to
run my query and one of the combo boxes is left blank the query won't pull
anything at all. But if all the boxes have a parameter chosen the query will
run. I have searched the properties of each box to change them so its
reflected they are not required however I am unable to find that option.
Please help...

Thank-you
 
Like [Forms]![frmParameter2]![txtParameter] & "*"

There can be problems with the above. For example is the form says "AB", the
above will return "ABC" also.
 
I'm not getting an error. The issue I am having is if I try to use my form to
run my query and one of the combo boxes is left blank the query won't pull
anything at all. But if all the boxes have a parameter chosen the query will
run. I have searched the properties of each box to change them so its
reflected they are not required however I am unable to find that option.
Please help...

It's nothing to do with the combo box's properties (well, you could set the
Default Value if that would help, but it probably wouldn't).

Try using a criterion of

= [Forms]![FormName]![combo] OR [Forms]![FormName]![combo] IS NULL

This will search for the user's entry, if there is one, and ignore the combo
if there isn't.
 
Thanks for the response Jerry.. I tried the code below and that did not work
it won't pull any data at all. Is there a way to skip a null combo box at
all?

Jerry Whittle said:
Like [Forms]![frmParameter2]![txtParameter] & "*"

There can be problems with the above. For example is the form says "AB", the
above will return "ABC" also.
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.


MsWatts said:
I'm not getting an error. The issue I am having is if I try to use my form to
run my query and one of the combo boxes is left blank the query won't pull
anything at all. But if all the boxes have a parameter chosen the query will
run. I have searched the properties of each box to change them so its
reflected they are not required however I am unable to find that option.
Please help...

Thank-you
 
Thanks so much everyone! John that worked perfectly you are truly awesome! I
have one more question and I will stop bothering you all lol... I have 2
linked tables one is full of numbers the other has the stored data that
corresponds to the numbers on my first table. I created a form and I would
like to pull the data for this form however I'm having a tough time doing
this. Would I need to create a new table OR is there some way to lookup the
info from one of the tables and have it populate on the form correctly??

Thanks again!!

John W. Vinson said:
I'm not getting an error. The issue I am having is if I try to use my form to
run my query and one of the combo boxes is left blank the query won't pull
anything at all. But if all the boxes have a parameter chosen the query will
run. I have searched the properties of each box to change them so its
reflected they are not required however I am unable to find that option.
Please help...

It's nothing to do with the combo box's properties (well, you could set the
Default Value if that would help, but it probably wouldn't).

Try using a criterion of

= [Forms]![FormName]![combo] OR [Forms]![FormName]![combo] IS NULL

This will search for the user's entry, if there is one, and ignore the combo
if there isn't.
 
Thanks so much everyone! John that worked perfectly you are truly awesome! I
have one more question and I will stop bothering you all lol... I have 2
linked tables one is full of numbers the other has the stored data that
corresponds to the numbers on my first table. I created a form and I would
like to pull the data for this form however I'm having a tough time doing
this. Would I need to create a new table OR is there some way to lookup the
info from one of the tables and have it populate on the form correctly??

A Query joining the two tables should work. Another possibility would be to
base the form on the table with the numbers, and use combo boxes bound to the
numbers to display the text.

However, since you do not indicate anything about the structure of the tables
nor how they "correspond", it's a bit hard to be specific. More info please!
 
Back
Top