Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

If/Then Not working 1

Status
Not open for further replies.

cooldisk2005

Technical User
Aug 3, 2005
119
US
All,
I have a field called PMA_num and the data type is set to Number.

It is on a form. When the form is opened it is opened as a new record with no data in the fields. When you look at this field when the form is opened, it has the number "0" in it.

I do not want a number to appear in this field when the form is opened.

I tried code like this on the OnOpen Event of the form but it doesn't work:

If PMA_num.value = "0" Then
PMA_num.value = ""
End IF

I tried these also, as the second part of the code:

PMA_num.value = False

Me.PMA_num = False

Me.PMA_num = Null

Nothing works!!!

Can someone please help me?

Any help would be appreciated.

Thanks in advance
 
Try this:

open the **table** in design view. Ensure that the default value for the field is not set to 0

Hope this helps
 
This database is at work, so I will check it tomorrow.

Now if it is not set to 0 then what?
 
When a table is designed in Access, and a field data type is set to a number, Access automatically inserts the default to 0.

Be careful here, because another form, calculated field, or ? within the project may expect the default number of 0. Changing this could break another area of your application.

Additionally, if this record is saved and the text box is blank, a null will be inserted into your table. Functions and calculations may not work.

I think this is probably the cause, if not, repost here.
 
Greely,
You were right!!! That is what the problem was and now everything is fine.

I will give you a star!!!!

Thanks so much.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top