AngelSpeaks
Active member
- Local time
- Today, 00:29
- Joined
- Oct 21, 2021
- Messages
- 547
I have a table, tblCPUpload. The two date columns have dates stored as mm/dd/yyyy without time stamp. An image of the table in datasheet view is below. PayrollStart and PayrollEnd, Date/Time columns
My code to extract rows, based on project number (the code below is using Job number), and create a CSV file for each project is as follows;
The second image is of the resulting CSV file with time as part of the date.
What am I doing wrong here? Thanks.
My code to extract rows, based on project number (the code below is using Job number), and create a CSV file for each project is as follows;
Code:
Do While Not rsJobs.EOF
Job = rsJobs!Job
Dim rsExportSQL As String
'Set up from/to for Job Selection
TempVars.Add "Job", Job
TempVars.Add "JobTo", Job
'Note: Job is a text field in tblCPUpload
rsExportSQL = "SELECT * FROM tblCPUpload " _
& "WHERE (ProjectNumber= " & "'" & Job & "' AND ProjectState = " & "'" & gstrState & "')"
Dim rsExport As DAO.QueryDef
Set rsExport = CurrentDb.CreateQueryDef("myExportQueryDef", rsExportSQL)
filename = directoryName & "\State " & gstrState & " Job " & Job & " Start Date " & sDate & " - CP Upload.csv"
sFile = filename
DoCmd.TransferText acExportDelim, , "myExportQueryDef", filename, True
rsJobs.MoveNext
Loop
msgText = "Extract Completed, look at folder " & gExportPath & " for extracted CSV files"
Response = MsgBox(msgText, vbOKOnly, msgApp)
End Sub
The second image is of the resulting CSV file with time as part of the date.
What am I doing wrong here? Thanks.