apending data to table from unbound form when form field blank

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Does anyone know a function or method to apend data from an unbound form to a
table when the form textbox is blank?
Dealing with only text fields in my table, am using code:

""" & Me![formfield1] & """

When the form field is blank it creates code "". (two double quotes side by
side)
The access table does not like this. (the
field property "required"
is set to no)

I was hoping to avoid the looping through all the textbox controls on my
form, seeing if it has a value then getting the name and value of the textbox
and building an sql statment.
 
What you are experiencing is a good argument for not using unbound controls.
(I love pain and I want to make my life harder!)

IIf(IsNull(Me![formfield1]), Null, """ & Me![formfield1] & """)
 
Yes that worked, I had to modify it a little:
from:
IIf(IsNull(Me![formfield1]), Null, Me![formfield1] & """)
to:
IIf(IsNull(Me![formfield1]), Null, Me![formfield1 & """ , """)

just before the IIf is: """ & Me![formfieldKEY] & """ , """ &

also in the
INSERT INTO [tablename] (Key, " & IIf(IsNull(Me![formfield1]), Null,
"formfield1,") & "" & IIf(IsNull . . . continue with more IIf statements

my table field names and form textbox control names are the same.
 
Back
Top