Here is the coding.
' MS Access related data Dim MyADOConn As ADODB.Connection Dim MyADOCmd As ADODB.Command Dim MyADORst As ADODB.Recordset Dim MySQL As String ' This Variables is to record the Date and Time ' It is to be used for create ProductionRecord + Date table Dim TodayTime As Date Dim TodayDate As Date Dim DateString As String Dim TimeString As String TodayDate = Format(Now(), "dd-mmm-yy") DateString = CStr(TodayDate) DateString = Left(DateString, 2) & Mid(DateString, 4, 2) & Right(DateString, 2) Set MyADOConn = New ADODB.Connection MyADOConn.ConnectionString = "Provider = Microsoft.jet.oledb.4.0;" _ & "Data Source = C:\XXX\DB\XXX.mdb" MyADOConn.Open Set MyADOCmd = New ADODB.Command Set MyADOCmd.ActiveConnection = MyADOConn MyADOCmd.CommandText = adCmdText MySQL = "CREATE TABLE PRODUCTIONREPORT" & DateString _ & " (ProductionID TEXT(50)CONSTRAINT PRODUCTIONID_PK PRIMARY KEY," _ & " Drop NUMBER(LONG INTEGER), " _ & " SetMinWeight NUMBER(DOUBLE), " _ & " SetMaxWeight NUMBER(DOUBLE), " _ & " EntryTime DATE/TIME, " _ & " Date DATE/TIME, " _ & " Weight NUMBER(DOUBLE) " MyADORst.Open MySQL, MyADOConn, adOpenDynamic, adLockOptimistic, adCmdText MyADORst.Update
When i run it, it prompt out run time error.. and saying that syntax error in field definition. When i go for debug it highlighted the code at MYADORST.Open ...........
Is the error caused by the datatype declaration error? or something else? Can anyone help me please.... Thanks in Advance

New Topic/Question
Reply




MultiQuote





|