Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Accress Database with VB6 HELP

Status
Not open for further replies.

np3il

Programmer
Aug 15, 2002
63
US
How do I make the report "rptDailySales.Show" get the new query generated by "DEConn.rsSQLCommand.Requery" ???

I have tried

rptDailySales.Show = DEConn.rsSQLCommand.Requery
and
rptDailySales.DataSource = DEConn.rsSQLCommand.Requery

but these generated an error.

Any suggestions ???

HELP !!!

Thanks B-)
 
Just close and re-open the DE connection, then send the new command. When you then show your report you should get the new vales:

With DataEnvironment1
If .Connection1.State <> 0 Then .Connection1.Close
DoEvents
.Connection1.Open
.Command1 (strParam1)
End With

rptDailySales.Show



________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'People who live in windowed environments shouldn't cast pointers.'
 
Thanks for the suggestion

But I am still getting an error message with the &quot;.Command1 (strParam1)&quot;.

the message is

Compile Error:
Wrong number of arguments or invalid property asignment


The Command1 is an SQL command in the .CommandText that is changed at runtime depending on the date entered.

The SQL command works great in the SQL editor, but I need it to work to generate the report.

What do I need to do with this command to make it work???

Can the strParam1 be an SQL command ???

Thanks in advanced :)
 
You don't need to rewrite the text of the Command object in code. The idea of using a Command is that you can set it as a SQL query, and include parameters as required.

command1 is a parameterised string - param1 is the parameter (in the example it's a string parameter)

Your command (if passing a date) might look like:
Select * from tblSales Where myDate = ?

On the Parameters tab of the Command set the parameter name and parameter type. Then go to your code as shown above. When you type in .Command1 Intellisense will show you the type and number of parameters expected by that Command. At run time just passing the parameter to the Command will automatically requery the Dataenvironment.

It's a lot easier than it looks!


________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'People who live in windowed environments shouldn't cast pointers.'
 
Thanks johnwm for the suggestion ...

Sorry for the delayed feedback... been out of commision for weeks ...

B-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top