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

Query & controls

Status
Not open for further replies.

elibb

Programmer
Oct 22, 2001
335
MX
hi... im using Crystal Reports in a vb project, and im doing it like this:

CrystalReport1.SQLQueryString = mySqlQuery
Form1.Show

but it is not paying atention to my string, and its loading all the records from my database.. does anybody know why??

and another question..
i have a textbox, and a field box, but i only want them to appear when that field has something on it.. i want it invisible when the field = "", how can i control that??

thank you very much

Eli
 
mmm my problem is how do i refer to the field on the report??

does anybody know about the query?? please...


Eli
 
mm i solved the Null part.. but im still having problems with the query.. please help!!!!!

Eli
 
Hmmm, have you tried setting a Record Selection Formula in your report?

Once you figure out what to put into your record selection formula you could do something like this:

Crpe1.Selection.Formula.Clear;
Crpe1.Selection.Formula.Add('Your selection criteria');

Sorry, that's the Delphi code - I don't know what the VB equivalent is.

Rupert
 
Try something like this to get the data from the text box to a string them in your select statement your "Where" condition would be Between "Date1" and "Date2"

Modified of course to fit your code.

Private Sub cmdDate_Click()
Dim date1 As String
Dim date2 As String

If Form1.txtDate1.Text <> &quot;&quot; Then
date1 = Form1.txtDate1.Text
Else: MsgBox &quot;Empty Field&quot;
End If
If Form1.txtDate2.Text <> &quot;&quot; Then
date2 = Form1.txtDate2.Text
Else: MsgBox &quot;Empty Field&quot;
End If
 
You may also need to do a &quot;CDate(Date1)&quot; to get it to work in you database otherwise you my get a type mismatch
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top