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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

hI, pLEASE HELP!. I am workin

Status
Not open for further replies.

lalee5

Technical User
Oct 20, 2002
70
US
hI, pLEASE HELP!.


I am working in data environment creating a report through datareport. I have the following code behind a print button. it is giving me an error message of invalid use of property stopping at:

.rsGrandTotal1 strParam1


How do you get the report to show only records with the date matching the inputbox?



I have try using the parameter in the parameter tab when I put a ? in the sql. it runs ok if I put a value in the value field. if I put the correct value it shows the records I specify. if I put a bogus value it shows nothing, which is what I want but then this doesn't give the user the opportunity to enter the date they want.

that is why I try the follwing but it doesn't seem to work. Please help anyone out there. I try looking at other thread but it doesnt seem to any my problem.


thanks
kay

Private Sub Command1_Click()
t = InputBox("Enter Date")


Dim strParam1 As String
strParam1 = "saldate by day=" & t
With DataEnvironment1
If .rsGrandTotal1.State <> 0 Then .rsGrandTotal1.Close
DoEvents
.rsGrandTotal1.Open
.rsGrandTotal1 strParam1
End With


Salestotalreport.Refresh
If Salestotalreport.Visible = False Then Salestotalreport.Show



End Sub
 
It looks like .rsGrandTotal1 is your Connection object.
You need to pass your parameter to the command object that contains the query, not to the Connection:

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



________________________________________________________________
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.'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top