Re: Inserting empty items into a field.



ED007 wrote:

I am using the SQL statement below to insert a record into a table. The
statement works fine if K contains a value. (both [ASH VALUE], AND [BULK
DENSITY] are double data types.) But I often want to set one or both to
empty/null. I seem to be able to do this if i edit the table manualy by
deleting the entry in those fields but how do I do it with the SQL statement.
Can I "set K to null somehow?


strSQL = "INSERT INTO [LOT QC DATA] " _
& "([COMPOUND LOT], DRUM, SAMPLE,[ASH VALUE],[BULK DENSITY]) " _
& "SELECT " _
& "'" & Me.LOT & "'" & "," & i & "," & j & "," & K & "," & K & ";"


Just set K to the string "Null" so the final SQL statement
looks something like:

INSERT INTO [LOT QC DATA] ([COMPOUND LOT], DRUM, SAMPLE,
[ASH VALUE], [BULK DENSITY])
SELECT '1234', 12, 34, Null, Null

--
Marsh
MVP [MS Access]
.



Relevant Pages

  • Re: Converting a number to Text
    ... I'm having a tough time with my SQL statement when I try to join two ... your text is not very long, if all you expect to do with it is to compare it ... comparing different data types (and in particular, ...
    (comp.databases.informix)
  • Insert problem !!
    ... I am having an insert problem with values of different data types. ... table with String int & decimal data types. ... trouble building the SQL statement ...
    (microsoft.public.dotnet.framework.adonet)
  • NULL Values in DataGrid
    ... How do I handle Null values in a DataGrid so the grid won't display 'null' if ... the field data is empty/null? ... The following SQL statement returns an error message "Invalid number of ...
    (microsoft.public.dotnet.framework.windowsforms)
  • SQL statement question
    ... I am updating a table using the following SQL statement: ... They are both text data types. ... are supposed to be two digits. ...
    (microsoft.public.access.formscoding)
  • Converting a number to Text
    ... I'm having a tough time with my SQL statement when I try to join two ... data types not being equal. ... Chaim Bochner ...
    (comp.databases.informix)