Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2007
    Posts
    17

    Unanswered: Newbie Question about Form Data

    Hi All

    I am trying to learn how to build custom reports for people in the office. Thus far i have had no problems creating the Form, stored procedure and the report. But where i am stumped is how to send the Form Data/variables through to the Stored procedure.

    For instance i have a combo box that allows for the selection of customer Ids, but when i place a valid customer Id in the field and run the report i get a popup that i think is from the stored procedure asking me for custId (which is a variable in the stored procedure)

    So i guess what i need to know is how to take the value from the combo box and send it to the stored procedure as the custId variable.

    I hope i am making sense.
    J

  2. #2
    Join Date
    Jan 2007
    Location
    California, USA
    Posts
    520
    Generally a stored procedure is in SQL Server. Are you using SQL Server, or do you mean query rather than a stored procedure?

  3. #3
    Join Date
    Jan 2007
    Posts
    17
    Hi Vic

    The stored procedure is in SQL, i've basically been looking at all of the other forms in the project and trying to learn on the fly. My form works the stored procedure works independantly as well, i feel that i may be missing something simple.

    Thanks
    J

  4. #4
    Join Date
    Jan 2007
    Location
    California, USA
    Posts
    520
    Here is a sample Sub within VBA that builds the Exec string for the pass-through query that I want run. This one happens to be a stored procedure that will update the Job record in the tblJob table with the billing amount that should have happened so far on the job. Here is the Sub:
    Code:
    Sub CalcBillingAmount(JobID As Long)
      Set qdef = CurrentDb.QueryDefs("spUpdateBillingAmount")
      qdef.sql = "Exec spUpdateBillingAmount @BillingAmount = " & _
            GetBillingAmount(JobID) & ", @JobID=" & JobID
      qdef.Execute
      On Error GoTo 0
      Set qdef = Nothing
      Exit Sub
    End Sub
    Then the SQL for the pass-through query ends up looking like this:
    Code:
    Exec spUpdateBillingAmount @BillingAmount = 2405, @JobID=20022527
    HTH,

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •