hai,
with the following code when i try to insert the date in the table, the time is inserted and not the date. I have set the RFQ Date field to Short date.
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim qdef As DAO.QueryDef
Dim rs1 As DAO.Recordset
Dim ddate As Date
Dim strSQL As String
Set db = DBEngine(0)(0)
Set rs1 = db.OpenRecordset("Select [RFQ Date] from [tbl RFQ] where [RFQ Name] = '" & RFQ_Name & "'", Type:=dbOpenDynaset)
ddate = rs1![RFQ Date]
Set rs = db.OpenRecordset("Select * from [tbl RFQ_Part Description] where [RFQ Description] = '" & RFQ_Description & "'", Type:=dbOpenDynaset)
While Not rs.EOF
connect = rs![RFQ description id]
s = "INSERT INTO [tbl RFQ] (RFQ_ID, [RFQ Name], [RFQ Description ID], [RFQ Date], [RFQ Status], Comments, [part number], [Yearly Demand], [RFQ Demand], [Unit Id], [Plant ID], [PTG ID] ) VALUES (RFQ_ID,RFQ_NAME," & connect & "," & ddate & " , 1, comments, partnum, unitdemand, rfqdemand, unit, plantid, ptgu);"
DoCmd.RunSQL (s)
rs.MoveNext
Wend
rs1.Close
Set rs1 = Nothing
rs.Close
Can anyone say what is wrong in the above insertion statement.
with the following code when i try to insert the date in the table, the time is inserted and not the date. I have set the RFQ Date field to Short date.
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim qdef As DAO.QueryDef
Dim rs1 As DAO.Recordset
Dim ddate As Date
Dim strSQL As String
Set db = DBEngine(0)(0)
Set rs1 = db.OpenRecordset("Select [RFQ Date] from [tbl RFQ] where [RFQ Name] = '" & RFQ_Name & "'", Type:=dbOpenDynaset)
ddate = rs1![RFQ Date]
Set rs = db.OpenRecordset("Select * from [tbl RFQ_Part Description] where [RFQ Description] = '" & RFQ_Description & "'", Type:=dbOpenDynaset)
While Not rs.EOF
connect = rs![RFQ description id]
s = "INSERT INTO [tbl RFQ] (RFQ_ID, [RFQ Name], [RFQ Description ID], [RFQ Date], [RFQ Status], Comments, [part number], [Yearly Demand], [RFQ Demand], [Unit Id], [Plant ID], [PTG ID] ) VALUES (RFQ_ID,RFQ_NAME," & connect & "," & ddate & " , 1, comments, partnum, unitdemand, rfqdemand, unit, plantid, ptgu);"
DoCmd.RunSQL (s)
rs.MoveNext
Wend
rs1.Close
Set rs1 = Nothing
rs.Close
Can anyone say what is wrong in the above insertion statement.