Results 1 to 3 of 3

Thread: Passing Parameters runs Once Only

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2002
    Posts
    1

    Question Passing Parameters runs Once Only

    Hello All

    Im having trouble with my DataReport. It works perfectly when run the first time. However when the button is run for a second time nothing occurs. and the report doesnt seem to show,

    I suspect its something to do with how the parameters are being passed.

    Heres the code :

    Private Sub cmdPrint_Click()
    On Error GoTo err_click
    'This sub must handle the name, order number and options
    'and process them into queries which print the applicable reports
    '!! Must also handle the process types of each order!!
    Dim OrderNoStr As Variant
    Dim Stk As String
    Dim Weight As String
    Dim Nameval As String
    Dim DateVal As String

    'Checks Order Number Value
    Nameval = Me.lstNames.Text

    If Me.dCboOrderNo.Text = "" Then
    MsgBox ("An Order Number must be entered")
    Exit Sub
    Else
    OrderNoStr = Me.dCboOrderNo.Text
    End If
    'Enters Todays Date if Checked
    If chkDate.Value = 1 Then
    DateVal = Now()
    Else
    DateVal = ""
    End If

    'Ask for Weight if Checked
    If Me.ChkWeight.Value = 1 Then
    Weight = InputBox("Enter the Weight Value", "Enter Weight")
    Else
    Weight = ""
    End If

    'Asks for Code if checked
    If Me.ChkStock.Value = 1 Then
    Stk = InputBox("Enter the Required code", "Enter Code")
    Else
    Stk = ""
    End If

    'Checks either cutting or rewind job
    If Me.OptCutting.Value = True Then
    DataBackend.qryReportCutting Weight, Stk, DateVal, Nameval, OrderNoStr
    LabelsCutting.Show
    LabelsCutting.PrintReport (True)

    'LabelsCutting.Show
    Else
    DataBackend.qryReportCutting Weight, Stk, DateVal, Nameval, OrderNoStr
    LabelsRewind.Show
    LabelsRewind.PrintReport (True)
    End If

    'Different reports exist for different process types.
    'Passes the Parameters to the query
    'DataBackend.qryReportCutting Weight, Stk, DateVal, OrderNoStr

    err_click:
    Exit Sub

    End Sub



    Could some please give me a hand.

    Thanks Alot

    Smurfaroonies

  2. #2
    Frenzied Member swatty's Avatar
    Join Date
    Aug 2002
    Location
    somewhere on earth
    Posts
    1,478
    Maybe you can try to put something in your error handler.

    It could be an error occurred and therefore you see nothing happen.

    You better change
    VB Code:
    1. err_click:
    2. Exit Sub
    3.  
    4. End Sub
    to
    VB Code:
    1. Exit Sub
    2. err_click:
    3.  
    4.  
    5. End Sub
    Code:
    If Question = Incomplete Then
       AnswerNextOne
    Else
       ReplyIfKnown
    End If
    cu Swatty

  3. #3
    Lively Member
    Join Date
    Jun 2002
    Location
    Kuwait
    Posts
    85
    Just close the query in the datareport's queryclose event as shown:

    Private Sub DataReport_QueryClose(Cancel As Integer, CloseMode As Integer)
    DataEnvironment1.rsCommand1.Close
    End Sub
    Your attitude determines your altitude!!!

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