Null Problems with using data access class (1 Viewer)

S

scottmech

Guest
I am just learning, but hopefully one of you can save me some time and keep my boss from killing me.

i am trying to use a class module to get information that i will use in several different forms. i plan to use this in a multi-user enviroment. my problem is that if ONE of the fields in the table is null, i get error 94 and can;t load form. i plan on only loading form to specific record, but want to get this to work first.

' from "frmCustomer"

Private Sub Form_Load()

Set mobjCustomers = New Customer

With mobjCustomers
.whatever
Me.txtCustomerID = .CustomerID
Me.txtCompanyName = .CompanyName
~~~~~~~~~~~~
End With

' from class module "Customer"

Public Sub whatever()
With mrst
mstrCustomerID = !CustomerID
~~~~~~~~~~~~


what do i do to allow for to load in a situation where ONE field is null?

please help, this is really pissing me off.

Thanks,
Scott Mech
 

Charlie

Registered User.
Local time
Today, 10:40
Joined
Jan 7, 2000
Messages
16
Scott,

I've encountered this problem quite a few times before and I use these solutions:

1) Wherever you enter/edit details into the table, you can make sure that user can't enter null values by using the after update event and check the value using:

if isnull(yourvalue) then
yourvalue = 0
endif

2) When you write the SQL query that will use the value (and is also causing problems) in the query string use the NZ(yourvalue) function which if null will return zero.


Hope this helps,

C
 

Users who are viewing this thread

Top Bottom