nitinsharma
Technical User
Hi All,
I have a simple database app which connects to a microsoft access 2.0 database using VB 6.0's data environment designer. I managed to add, delete, even specify a query which selects records with date= certain value. However, when I use the following code to select records within a range of dates i get a syntax error on the line where the command is called from the data environment. I am trying to run this command during run-time - My command is based on a sql query which has the following syntax:
this causes the command to take on two parameters, startrange and endrange. it works fine when only one value is specified, i.e.
works fine with just one parameter input, but when you use a range the IDE itself throws a syntax error (Which says Expected :=) and refuses to compile the code.
I am perplexed why a simple SQL command change is throwing such a major spanner in my works. I know that DAO and data environment designers are pretty unpopular in this forum but my work is almost over and this is the last straw that is breaking my back. Help anybody, I am desperate help! Thanks for reading so patiently,
Regards
NS.
I have a simple database app which connects to a microsoft access 2.0 database using VB 6.0's data environment designer. I managed to add, delete, even specify a query which selects records with date= certain value. However, when I use the following code to select records within a range of dates i get a syntax error on the line where the command is called from the data environment. I am trying to run this command during run-time - My command is based on a sql query which has the following syntax:
Code:
SELECT `Date`, `Time`, BS, Qty, `Month`, Strike, ProdTyp, Price, ID FROM trades WHERE (`Date` >= startrange) AND (`Date` <= endrange)
Code:
SELECT `Date`, `Time`, BS, Qty, `Month`, Strike, ProdTyp, Price, ID FROM trades WHERE (`Date` >= startrange)
Code:
Private Sub optnRange_Click()
If range1 = "" Then
range1 = Text8.Text
range2 = Text9.Text
DataEnvironment1.dtrange(range1,range2) 'ERROR
Else:
DataEnvironment1.rsdtrange.Close
range1 = Text8.Text
range2 = Text9.Text
DataEnvironment1.dtrange(range1,range2) 'ERROR
End If
DataGrid1.DataMember = dtrange
DataGrid1.Refresh
Label3(0).Caption = "Display: In Range"
End Sub
I am perplexed why a simple SQL command change is throwing such a major spanner in my works. I know that DAO and data environment designers are pretty unpopular in this forum but my work is almost over and this is the last straw that is breaking my back. Help anybody, I am desperate help! Thanks for reading so patiently,
Regards
NS.