Results 1 to 3 of 3

Thread: SQL with form variables?

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 2000
    Posts
    54

    Exclamation

    I have two calendar controls on my form and i want to use the dates they enter from the form to an Sql statement I'm creating in the SQL builder.
    I tried putting the variable names in the criteria and it says "frdate not an expression in this query"
    I made the variable global and it still didnt work..?

    Any ideas on what i'm missing?
    it would be greatly appreciated..
    thank you ahead of time for all or any help
    ~Jason

  2. #2
    Hyperactive Member
    Join Date
    Feb 2000
    Posts
    284
    Show us some code there!

  3. #3

    Thread Starter
    Member
    Join Date
    Aug 2000
    Posts
    54

    heres some code..

    Okay
    Basically I created a Data Environment, configured the connection to my sql server, then added a command to the connection. In the properties of my command there is an option to use the SQL builder, which is what I used to make the sql statement.

    this is basically the sql statement I want.. using the frdate and todate from the calendar controls on the form.

    SELECT ARN_InvHistoryHeader.InvoiceNumber, ARN_InvHistoryHeader.HeaderSeqNumber, ARO_InvHistoryDetail.SOQtyShipped, ARN_InvHistoryHeader.SOShipDate FROM ARN_InvHistoryHeader, ARO_InvHistoryDetail WHERE
    AND ARN_InvHistoryHeader.SOShipDate IN (frdate) TO (todate)

    and the code for my form is here..


    Public ltr As String
    Public todate, frdate As Date

    Private Sub cmdexit_Click()
    End
    End Sub

    Private Sub cmdrun_Click()
    'Calendar Controls
    calfrom.Value = frdate
    calto.Value = todate
    'Exporting my sql report

    DataReport1.ExportReport rptKeyText, "c:\windows\desktop\test.txt", True
    End Sub

    Private Sub Form_Load()
    Open "C:\Setup.ini" For Input As #1
    Line Input #1, ltr
    Close #1
    End Sub

    I hope that helps.. thanks again
    Last edited by Flamer; Feb 23rd, 2001 at 10:31 AM.

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