|
-
Aug 1st, 2007, 09:17 AM
#1
Thread Starter
Frenzied Member
[RESOLVED] Still problem passing empty date values
I originally had the Date fields in my DB set as Text (I know ) but i have now changed then to Date/Time type values.
I am now going through my program and updating the SQL statements to take this into account.
So...
In the following code, I have 1 date value that is Null, but I am getting the error message:
Syntax error in date in query expression '##'
What is wrong with this SQL statement?
Code:
Dim strSQL2 As String
strSQL2 = "INSERT INTO tbl_EX_Membership"
strSQL2 = strSQL2 & " Values (" & rs!Memb_ID.Value & "," & vbCrLf & _
"'" & rs!First_Name.Value & "'," & vbCrLf & _
"'" & rs!Middle_Name.Value & "'," & vbCrLf & _
"'" & rs!Surname.Value & "'," & vbCrLf & _
"'" & rs!Street.Value & "'," & vbCrLf & _
"'" & rs!Town.Value & "'," & vbCrLf & _
"'" & rs!City.Value & "'," & vbCrLf & _
"'" & rs!County.Value & "'," & vbCrLf & _
"'" & rs!Post_Code.Value & "'," & vbCrLf & _
"'" & rs!Home_Tel.Value & "'," & vbCrLf & _
"'" & rs!Mobile_Tel.Value & "'," & vbCrLf & _
"'" & rs!Email.Value & "'," & vbCrLf & _
"#" & rs!DOB.Value & "#," & vbCrLf & _
"#" & rs!Date_Joined.Value & "#," & vbCrLf & _
"#" & rs!Insurance_Due.Value & "#," & vbCrLf & _
"'" & rs!Grade.Value & "'," & vbCrLf & _
"#" & rs!Last_Graded.Value & "#," & vbCrLf & _
"'" & rs!Membership_Number.Value & "'," & vbCrLf & _
"'" & rs!Occupation.Value & "'," & vbCrLf & _
"'" & rs!Notes.Value & "')"
cn.Execute strSQL2
 Originally Posted by Debug.Print
debug.Print strsql2
INSERT INTO tbl_EX_Membership Values (47,
'Brian',
'Aurthur',
'Smith',
'22 Anystreet',
'Anytown',
'Anycity',
'Anycounty',
'BG68UY',
'01779999999',
'07968888999',
'',
#22/05/1984#,
#06/07/2007#,
#06/07/2008#,
'White',
##,
'M5678',
'Painter',
'')
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|