|
-
May 8th, 2000, 04:07 PM
#1
Thread Starter
Member
I am using Access Database in my VB application.
Thare is one table which contains HireDate field which is of Date data type.This Field is optional.How can i insert a null date into it using SQL Insert Statement From VB. I am using DAO and Execute method.
Thanks in Advance
-
May 8th, 2000, 04:14 PM
#2
Frenzied Member
Why do you need a Null date?
If the field is set as Required = No then surely there shouldn't be a problem?
-
May 8th, 2000, 04:35 PM
#3
Thread Starter
Member
Thank for repplying.
Suppose the user is not willing to supply the value right now then the value will be null string.
Actually what is going on here is
I have a text box in to which the user can enter a date.
the SQL looks like this
strSQL="INSERT INTO <table name> (<field1>,<field2>,<date field>) VALUES (" & txtField1.text & "," & txtField2.text & ",'" & txtDateField.txt &"')"
If there is no date in the txtDateField textbox Still it should work.
Now Think of it.
[Edited by gorthims on 05-09-2000 at 05:38 AM]
-
May 8th, 2000, 04:42 PM
#4
Frenzied Member
Personally I would check that the date textbox was valid first eg:
Code:
If IsDate(txtDateField.Text) Then
strSQL = "INSERT INTO <table name> (<field1>,<field2>,<date field>) VALUES (" & txtField1.Text & "," & txtField2.Text & ",'" & txtDateField.Text & "')"
Else
strSQL = "INSERT INTO <table name> (<field1>,<field2>) VALUES (" & txtField1.Text & "," & txtField2.Text & "')"
End If
-
May 8th, 2000, 04:49 PM
#5
Thread Starter
Member
I think that is not the appropriate solution. Because if there are are a number of optional date fields then you can not have that many no. of SQL statements(Permutations and combinations).
Please think about it and find the solution for me
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
|