Results 1 to 3 of 3

Thread: Crystal Reports Help Please

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2005
    Location
    South Africa
    Posts
    400

    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.

    VB Code:
    1. vbcode
    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

    VB Code:
    1. vbcode

    Please can someone assist me.

    Many thanks in advance.

  2. #2
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: Crystal Reports Help Please

    Try
    VB Code:
    1. isql = "SELECT Guests.* FROM Guests WHERE Guests.[Arrival Date] = #" & txtdate.Text & "#"
    2. 'or use this if [Arrival Date] is a string field
    3. isql = "SELECT Guests.* FROM Guests WHERE Guests.[Arrival Date] = '" & txtdate.Text & "'"

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2005
    Location
    South Africa
    Posts
    400

    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
  •  



Click Here to Expand Forum to Full Width