the date Formats in VB6 n in access are different. i have written an insert query for inserting all details including date into the database but it is not working. i think it is because of this format difference. how do i handle it???
Date
Collapse
X
-
Can you post your sql statement here? Did you check the datatypes of your fields?Originally posted by mcluelessthe date Formats in VB6 n in access are different. i have written an insert query for inserting all details including date into the database but it is not working. i think it is because of this format difference. how do i handle it???
Did you enclosed the dates in your sql query with #?
Rey Sean -
Originally posted by mcluelessthe date Formats in VB6 n in access are different. i have written an insert query for inserting all details including date into the database but it is not working. i think it is because of this format difference. how do i handle it???
Hey,
u can take the Date as String, then perform ur other tasks.Comment
-
This is unadvisable.... .Originally posted by shuvo2k6Hey,
u can take the Date as String, then perform ur other tasks.Comment
-
-
rs.Open "insert into Invoice_master( Inv_No,Inv_Date ,Inv_Type,Cust_ Code,Salesman_C ode,Due_Date) values(" & Val(txtInvNo.Te xt) & ",'" & txtDate.Text & "','" & txtInvType.Text & "'," & Val(txtCustCode .Text) & "," & Val(txtSaleCode .Text) & ",'" & txtDue.Text & "')", con, 3, 3
This is the insert statement. tell me where to make changes.Comment
-
HiOriginally posted by mcluelessrs.Open "INSERT INTO Invoice_master( Inv_No,Inv_Date ,Inv_Type,Cust_ Code,Salesman_C ode,Due_Date) VALUES " & Val(txtInvNo.Te xt) & ",'" & txtDate.Text & "','" & txtInvType.Text & "'," & Val(txtCustCode .Text) & "," & Val(txtSaleCode .Text) & ",'" & txtDue.Text & "')", con, 3, 3
This is the insert statement. tell me where to make changes.
Change your codes to
[code=vb]
rs.Open "INSERT INTO Invoice_master( Inv_No,Inv_Date ,Inv_Type,Cust_ Code,Salesman_C ode,Due_Date) VALUES (" & Val(txtInvNo.Te xt) & ",#" & txtDate.Text & "#,'" & txtInvType.Text & "'," & Val(txtCustCode .Text) & "," & Val(txtSaleCode .Text) & ",#" & txtDue.Text & "#)", con, 3, 3
[/code]
Rey SeanComment
-
Originally posted by lotus18Hi
Change your codes to
[code=vb]
rs.Open "INSERT INTO Invoice_master( Inv_No,Inv_Date ,Inv_Type,Cust_ Code,Salesman_C ode,Due_Date) VALUES (" & Val(txtInvNo.Te xt) & ",#" & txtDate.Text & "#,'" & txtInvType.Text & "'," & Val(txtCustCode .Text) & "," & Val(txtSaleCode .Text) & ",#" & txtDue.Text & "#)", con, 3, 3
[/code]
Rey Sean
I tried the above query bt I am getting the following error....
Syntax error in date in query expression '# #' .Comment
-
Really?, May I see your sample value in txtDate and txtDue. Are your Inv_Date and Due_Date are Date/Time Datatypes?Originally posted by mcluelessI tried the above query bt I am getting the following error....
Syntax error in date in query expression '# #' .
Rey SeanComment
Comment