Can someone please explain to me what the line of code:
qdf.SQL = strSQL
is accomplishing?
1.strSQL = "SELECT DailyPrice.Symb ol, DailyPrice.Loca teDate, DailyPrice.Mark etPrice, DailyPrice.Pric eFlag FROM DailyPrice " & _
"WHERE DailyPrice.Symb ol IN (" & strCriteria & ") " & _
"ORDER BY DailyPrice.Symb ol, DailyPrice.Loca teDate;"
'*****great stuff here type: Set qdf = db.querydefs into thescripts
Set qdf = CurrentDb.Query Defs("qryDummy" )
qdf.SQL = strSQL
DoCmd.OpenQuery ("qryDummy")
Private Sub cmbSelectionDon e_Click()
Dim db As DAO.Database
Dim qdf As DAO.QueryDef
Dim varItem As Variant
Dim strCriteria As String
Dim strSQL As String
Set db = CurrentDb()
Set qdf = db.QueryDefs("q ryMultiSelect")
If Me!cboxRangeNam e = -1 Then
myPath = txtFilePath & txtImportName
myExport = Me!txtExportNam e
myImport = Me!txtImportNam e
DoCmd.SetWarnin gs (False)
DoCmd.RunSQL "DELETE * FROM TempSymbol"
DoCmd.SetWarnin gs (True)
DoCmd.TransferS preadsheet acImport, , "TempSymbol ", "" & myPath & "", True, "" & txtRangeName & ""
MsgBox "The symbols have been successfully imported."
strSQL = "SELECT DailyPrice.Symb ol, DailyPrice.Loca teDate, DailyPrice.Mark etPrice, DailyPrice.Pric eFlag " & _
"FROM TempSymbol, DailyPrice " & _
"WHERE (((DailyPrice.S ymbol) = [TempSymbol]![Symbol])) " & _
"ORDER BY DailyPrice.Symb ol, DailyPrice.Loca teDate;"
qdf.SQL = strSQL
'check this out...maybe delete it later
myPath = txtFilePath & txtExportName
DoCmd.TransferS preadsheet acExport, , "qryMultiSelect ", "" & myPath & ""
MsgBox "The table have been successfully exported to: " & myExport & "."
DoCmd.Close
qdf.Close
Set db = Nothing
Set qdf = Nothing
Exit Sub............ ......
qdf.SQL = strSQL
is accomplishing?
1.strSQL = "SELECT DailyPrice.Symb ol, DailyPrice.Loca teDate, DailyPrice.Mark etPrice, DailyPrice.Pric eFlag FROM DailyPrice " & _
"WHERE DailyPrice.Symb ol IN (" & strCriteria & ") " & _
"ORDER BY DailyPrice.Symb ol, DailyPrice.Loca teDate;"
'*****great stuff here type: Set qdf = db.querydefs into thescripts
Set qdf = CurrentDb.Query Defs("qryDummy" )
qdf.SQL = strSQL
DoCmd.OpenQuery ("qryDummy")
Private Sub cmbSelectionDon e_Click()
Dim db As DAO.Database
Dim qdf As DAO.QueryDef
Dim varItem As Variant
Dim strCriteria As String
Dim strSQL As String
Set db = CurrentDb()
Set qdf = db.QueryDefs("q ryMultiSelect")
If Me!cboxRangeNam e = -1 Then
myPath = txtFilePath & txtImportName
myExport = Me!txtExportNam e
myImport = Me!txtImportNam e
DoCmd.SetWarnin gs (False)
DoCmd.RunSQL "DELETE * FROM TempSymbol"
DoCmd.SetWarnin gs (True)
DoCmd.TransferS preadsheet acImport, , "TempSymbol ", "" & myPath & "", True, "" & txtRangeName & ""
MsgBox "The symbols have been successfully imported."
strSQL = "SELECT DailyPrice.Symb ol, DailyPrice.Loca teDate, DailyPrice.Mark etPrice, DailyPrice.Pric eFlag " & _
"FROM TempSymbol, DailyPrice " & _
"WHERE (((DailyPrice.S ymbol) = [TempSymbol]![Symbol])) " & _
"ORDER BY DailyPrice.Symb ol, DailyPrice.Loca teDate;"
qdf.SQL = strSQL
'check this out...maybe delete it later
myPath = txtFilePath & txtExportName
DoCmd.TransferS preadsheet acExport, , "qryMultiSelect ", "" & myPath & ""
MsgBox "The table have been successfully exported to: " & myExport & "."
DoCmd.Close
qdf.Close
Set db = Nothing
Set qdf = Nothing
Exit Sub............ ......
Comment