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!

VB's Datareports

Status
Not open for further replies.

robman70

Technical User
Aug 6, 2002
90
I'm using vb's datareports to create invoices, the only problem is i havent been able to figure out how to put a vb variable from the project into the query, im using the query builder and i tried just declaring the variable as public and in the criteria column putting '= frmForm.strVar' but it wont let me do that, im sure there has to be a way to do this, any help is appreciated.
 
Write so:

Private Sub Command1_Click()

DataReport1.Sections("section4").Controls.Item("Label2"). _
Caption=Variable
DataReport1.Show

Variable it will be put in Label2 which is in section 4 on DataReport.

mi1306
 
If i take out the datasource in the report properties then i get an error saying invalid datasource, if i put it back in i get an error saying failed to get rowset from current datasource, what am i doing wrong?
 
You mention query builder - is this in Access or in VB?
If in VB, what are you using for your datasource?
If you are building a SQL type query, then substitute your variable name in the SQL string:

strSQL = "Select * from tblUser where UserName = '" & text1.text & "'"

To avoid the risk of a SQL injection attack, you'll need to carefully check your input text. There have been several threads dealing with this. For example Thread222-640856 (see chiph's post in that thread)

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

'If we're supposed to work in Hex, why have we only got A fingers?'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top