|
-
Apr 24th, 2006, 01:57 AM
#1
Thread Starter
Hyperactive Member
Crystal Reports Help Please
Hi
Please can someone help me, i am using crystal reports 8 and am rather fimiliar with it. But what i would like to do is, i am using an access database, with one of the fields being "Arrival Date", i have a text box on my form with the current date in it at form load, so now what i want to do is only print out the customer names that match the date in the textbox but i am really struggling, in my very limited sql knowledge i have written the following code, i don't get any errors and the report prints out every name in the database, when it should only print the names that match the current date.
Dim adoCon As ADODB.Connection
Set adoCon = New ADODB.Connection
adoCon.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\quick-res\DATA\data.mdb;Persist Security Info=False"
Dim isql As String
isql = "SELECT Guests.[Arrival Date] FROM Guests WHERE Guests.[Arrival Date] = txtdate.Text"
With rptMain
.ReportFileName = ("C:\Test2.rpt")
.SQLQuery = lSql
.Destination = crptToWindow
End With
If rptMain.PrintReport <> 0 Then
MsgBox rptMain.LastErrorString
Screen.MousePointer = vbDefault
End If
Please can someone assist me.
Many thanks in advance.
-
Apr 24th, 2006, 03:20 AM
#2
Re: Crystal Reports Help Please
Try
VB Code:
isql = "SELECT Guests.* FROM Guests WHERE Guests.[Arrival Date] = #" & txtdate.Text & "#"
'or use this if [Arrival Date] is a string field
isql = "SELECT Guests.* FROM Guests WHERE Guests.[Arrival Date] = '" & txtdate.Text & "'"
-
Apr 24th, 2006, 05:03 AM
#3
Thread Starter
Hyperactive Member
Re: Crystal Reports Help Please
Hi Brucevde
Thank you for your reply, i have tried what you've suggested but with the same effect, it still pulls up all the name is the database. Is there another way to do it?
Many thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|