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

variables on reports

Status
Not open for further replies.

drewdaman

Programmer
Aug 5, 2003
302
0
0
CA
hello again everyone

some more problems:(

i have a report that is opened from a form. i have the user enter some stuff on the form and based on that the report (which is based on a query) is opened (when the user presses a button on the form). i want the report to have what the user types in on hte form.
what i did was to put this line where i want the stuff the user enters.... but when the report opens, the code is waht shows up! i used a label to put the following in, into the report:
=Forms!SearchBarCode!BarCode.text()

i also tried:
=Forms!SearchBarCode!BarCode.text
=Forms!SearchBarCode!BarCode.value
=Forms!SearchBarCode!BarCode.value()

all of these result in hte same thing, ie the line of code is displayed on the report. maybe i shouldn't use a label to put this in.. maybe i should.. maybe this is not possible at all! i don't know....

any input on this would be really really helpful! thanks in advance!
 
Decalre public variable in form and use them in report section "on format" event.
 
hey.. thanks for the tip... thats been another problem of mine! i can't seem to declare a public variable in vb!! do you declare it in the place where it says option explicit database or farther down in the code?
also, how would i access the public variable?

thanks!
 
also.. i cna't seem to change the content of the label... i made a label.. its called Label23. The following code does now seem to work:

Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As Integer)
Label23 = "test"
End Sub

thanks.
 
use the .caption explicit call.

ie. label23.caption = "test"

also, i believe the reason the =Forms!SearchBarCode!BarCode.text() with a label didn't work for you is that labels cannot be used from the Form/Report Designer to perform calculated or derived fields. You have to use a textBox.

If you wish to use labels in this manner you have to set the caption programmatically in the OnFormat event

Alec
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top