Hello all, you have helped me in the past, lets see if anyone knows what it going on here.
I have a form that uses a recordset to update a query. Among the fields that need entered are coordinate fields, which are Numeric Double fields. The coordinates must have a Y1 and X1 coordinate, and they may have a Y2 and X2 coordinate, but not necessarily.
This causes a 'data type conversion' error when either the Y2 or X2 fields are left empty, as it does not want to input a null value into the field.
Me understanding is that the Nz() function should be able to fix this, as it returns an empty string instead of Null. However I still get the same 'data type conversion" error
Here is my (selected) code:
For instance, if I have a number entered in the "Y1" field of my form, and not in the "Y2" field, when I try to save the records its pops up with the "data type conversion error" with the "Y2" line of code highlighted in the debugger. Am I using the Nz() function wrong?Code:Set rsBoxEntry = WorkingDB.OpenRecordset(Me.Year, dbOpenDynaset) For i = 1 To Me.HowMany rsBoxEntry.AddNew rsBoxEntry!Y1 = Nz(Me.Y1) rsBoxEntry!Y2 = Nz(Me.Y2) rsBoxEntry!X1 = Nz(Me.X1) rsBoxEntry!X2 = Nz(Me.X2)
Any help is appreciated.
--Evan