Null insert statement

astarbyfar

Registered User.
Local time
Today, 03:17
Joined
Apr 27, 2003
Messages
93
Hey, me again I have the following module:

Code:
Private Sub Exit_Click()
Dim sqlstring As String

sqlstring = "INSERT INTO Location ([PSM Code], [Tool number], [Model No], [Die Bay], [Line number], [Linked to], [Press1], [Press2], [Press3], [Press4], [Press5], [Press6], [location1])"
sqlstring = sqlstring & "VALUES ('" & Me.linked & "', '" & Me.Part_Number & "', '" & Me.Model_No & "', '" & Me.Die_Bay & "', '" & Me.Line_Number & "', '" & Me.PSM_Code & "', '" & Me.Press1 & "', '" & Me.Press2 & "', '" & Me.Press3 & "', '" & Me.Press4 & "', '" & Me.Press5 & "', '" & Me.Press6 & "', '" & Me.location1 & "');"


DoCmd.RunSQL sqlstring
DoCmd.SetWarnings False
DoCmd.RunMacro "Die locations"

End Sub

This works fine when there is data located in each of the text boxes but unfortunately if there is no data in one of the text boxes then the data is not inserted. Is there a way of allowing nulls to still be entered?

Regards
 
Star,

The *problem* lies within your table definition. Get your table in Design View
and set the field's property "Allow Zero Length" to yes.

Wayne
 

Users who are viewing this thread

Back
Top Bottom