VB6 Data Report in Code

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Richard Alvarez
    New Member
    • Apr 2011
    • 32

    #1

    VB6 Data Report in Code

    Need help my data report

    I got this error "No value given for one or more required parameter."

    here is my code...
    Code:
    Dim rsData As New Adodb.Recordset
    On Error GoTo err:
        If rsData.State = adStateOpen Then rsData.Close
            rsData.Open "SELECT * FROM EMPLOYEEINFO WHERE EMP_ID=" & Me.lstEmployeeMain.SelectedItem.Text & ";", DBConn, adOpenKeyset, adLockPessimistic
            Set DataRep_Employee_Info_Single.DataSource = rsData
            DataRep_Employee_Info_Single.Show 1
        Exit Sub
    err:
        MsgBox err.Description, vbCritical, "Error"
        Set rsData = Nothing
    Thank you so much in advance..
  • 9815402440
    New Member
    • Oct 2007
    • 180

    #2
    this error occurs when a field you are referring in the query does not exists in the table. in this case check whether EMP_ID exists in the EMPLOYEEINFO table?
    regards
    manpreet singh dhillon hoshiarpur

    Comment

    • Richard Alvarez
      New Member
      • Apr 2011
      • 32

      #3
      Thank you so much it did solve the problem. And also I discover one more thing with my code; I need to use this syntax for it to work properly.
      Code:
      rsData.Open "SELECT * FROM EMPLOYEEINFO WHERE EMP_ID=" & Trim(Me.lstEmployeeMain.SelectedItem.Text) & ";", DBConn, adOpenKeyset, adLockPessimistic
      Thank you again for your quick reply

      Comment

      Working...