PDA

Click to See Complete Forum and Search --> : Saving Null fields in ADO/VB/ACCESS


Pallex
Feb 1st, 2000, 07:09 PM
Hi!

I have a little problem...

When reading data from a record, and putting it into control
properties, i was using :

frmWhatever.TxtWhatever = !FieldToRead

which worked fine. However, when FieldToRead was a blank field, i got an error. The solution was :

frmWhatever.TxtWhatever = "" & !FieldToRead


I now have the same problem saving data. The following is fine when theres data present, but not otherwise:

!FieldToWrite = "" & frmWhatever.TxtWhatever

the "" & fix doesnt work here (I also tried not using it - same result).

What should i do? I`m really looking to avoid an IF...THEN case for each field i write.

Any ideas?

Thanks,
Alex.

bsmith
Feb 1st, 2000, 08:50 PM
You can try this:

!FieldToWrite = IIF(frmWhatever.TxtWhatever<>"",frmWhatever.TxtWhatever,vbNull)