Question Locked

How to write a SQL statement in VB6

0 helpful
4 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
I am trying to create a report in VB6 where the the user picks 2 different dates and the results are then sent to a datareport to be printed. My problem is I do not know how to incorporate my user defined dates into the SQL Statement. Nor do I know the proper syntix for manualy writting it into the commaned buttion or how this would be accomplished using the SQL builder.

4 replies

by sawan gupta

You need to create a ADODB.recordset object.
Run the sql query using it. You can specify the dates in the sql query which the user selected.

Then
DataReport.DataSource=
DataReport.Refresh
and then simply display your data report. :)

by chick pink

what is the basic program in class structure?
And the simple tips on how to make such program.Also in turbo c and c++.

by velmourugane

Dim start_date, end_date As String
start_date = Format(DTP_start_date.Value, "dd/MMM/yyyy")
end_date = Format(DTP_end_date.Value, "dd/MMM/yyyy")
If dtenv_monthwise.rsCommand1_Grouping.State = adStateOpen Then
dtenv_monthwise.rsCommand1_Grouping.Close
End If

Set rpt_monthwise = Nothing
dtenv_monthwise.Command1_Grouping start_date, end_date
rpt_monthwise.Show
Unload Me

This discussion is closed to new replies.