I am creating a table dynamically of which fields are date. I have a running code below but I want to remove those doble quotes in both sides.. If I remove the chr(34) on both ends, I get this error saving "invalid field defination". My code and table screen shots below:
'create temporary profit & loss table which fields includes the months date
Dim qrystr, tbl_profit_loss As String
Dim lastmonthdates As Date
Dim runningdate As Date
Randomize
qrystr = "CREATE TABLE " & "tbl_profit_loss" & Minute(Now) & Round(Second(Now) * Rnd()) & " ("
qrystr = qrystr & "AccntID VARCHAR(10), AccntName VARCHAR(100), "
runningdate = DateSerial(Year(fromdate), Month(fromdate) - 1, Day(fromdate))
While runningdate < DateSerial(Year(todate), Month(todate), 0)
runningdate = DateSerial(Year(runningdate), Month(runningdate) + 1, Day(runningdate))
lastmonthdates = DateSerial(Year(runningdate), Month(runningdate) + 1, 0)
qrystr = qrystr & Chr(34) & lastmonthdates & Chr(34) & " CURRENCY DEFAULT 0, "
Wend
'---------------------------------------------------------------------------------------------
qrystr = Left(qrystr, Len(qrystr) - 2) 'remove last comma in the right of the query string
qrystr = qrystr & ")" 'close the query string with closing parenthesis
MsgBox qrystr
scnn.Execute qrystr, , adCmdText
Thank you for helping!