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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Number fields and Text boxes

Status
Not open for further replies.

rookery

Programmer
Apr 4, 2002
384
GB
I know this is probably quite a trivial question but why am I getting a Data Type Conversion error when I try and save nothing ("") into a Number field in a table.

The field size is Long Integer and Format is General Number. I've also set Required to "No". The Format of the text box is set to General Number.

I can see that it doesn't recognise the "" but even if I use the Nz function it doesnt seem to work.

e.g. With MyRs
.AddNew
!adNumeric = Nz(Me.txtAdNumeric)
.Update
End With

Any ideas?
 
Hi

To begin, NZ() requires two parameters eg Nz(Me.txtAdNumeric,"").

Have you tried:

!adNumeric = Null




Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
UK
 
Thanks Ken. Firstly the second argument is optional and secondly I cant set a field to to Null if there's a chance there may be something in the text box.

I've decided to use the trusty:

If Not Me.txtAdNumeric = "" then
'do something
End if

Crude but effective. Cheers.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top