BHaniszewski
03-29-2011, 10:45 AM
I have a excel document which has data on it.
My access program is written so that I paste in the file location, the next button I press will go out and collect the data from 2 tabs from the Excel sheet. On the sheet there is columns that have Alphanumeric characters and others have dates. How do I write the code to import the dates correctly.
Also some of the columns may contain data or not, I need the VB code to check to see if it is null, if so it skips. I included the code I wrote for this but not sure if there is something missing.
'pulls information for UPDATE REPORT STATUS column 11
If IsNull(objWorkBook.Sheets("COMPLETE").Cells(rowcnt, 11)) Then
sql = sql & " Null"
Else
If Trim(objWorkBook.Sheets("COMPLETE").Cells(rowcnt, 11)) = "" Then
sql = sql & " Null"
Else
sql = sql & " #" & objWorkBook.Sheets("COMPLETE").Cells(rowcnt, 11) & "#"
End If
End If
sql = sql & " as UPDATE REPORT STATUS, '"
My access program is written so that I paste in the file location, the next button I press will go out and collect the data from 2 tabs from the Excel sheet. On the sheet there is columns that have Alphanumeric characters and others have dates. How do I write the code to import the dates correctly.
Also some of the columns may contain data or not, I need the VB code to check to see if it is null, if so it skips. I included the code I wrote for this but not sure if there is something missing.
'pulls information for UPDATE REPORT STATUS column 11
If IsNull(objWorkBook.Sheets("COMPLETE").Cells(rowcnt, 11)) Then
sql = sql & " Null"
Else
If Trim(objWorkBook.Sheets("COMPLETE").Cells(rowcnt, 11)) = "" Then
sql = sql & " Null"
Else
sql = sql & " #" & objWorkBook.Sheets("COMPLETE").Cells(rowcnt, 11) & "#"
End If
End If
sql = sql & " as UPDATE REPORT STATUS, '"