Problem with SQL in VB6

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mclueless
    New Member
    • Jan 2008
    • 56

    Problem with SQL in VB6

    i m using vb6 n access. i am not able to use summary function that i have used in SQL query in VB6.

    Call Connection
    Set rs = New ADODB.Recordset
    rs.Open "SELECT max(Inv_No) FROM Invoice_Master" , con, 3, 3
    txtInvNo.Text = rs!Inv_No

    I m getting error 3265.
  • mafaisal
    New Member
    • Sep 2007
    • 142

    #2
    Hello
    Try this
    Set rs = New ADODB.Recordset
    rs.Open "SELECT max(Inv_No) as Inv_No FROM Invoice_Master" , con, 3, 3
    txtInvNo.Text = rs!Inv_No

    set alias name for fields max(Inv_No) default it have no column name

    Originally posted by mclueless
    i m using vb6 n access. i am not able to use summary function that i have used in SQL query in VB6.

    Call Connection
    Set rs = New ADODB.Recordset
    rs.Open "SELECT max(Inv_No) FROM Invoice_Master" , con, 3, 3
    txtInvNo.Text = rs!Inv_No

    I m getting error 3265.

    Comment

    • werks
      New Member
      • Dec 2007
      • 218

      #3
      Where does the error located?


      Better Than Yesterday ^^

      Comment

      • mafaisal
        New Member
        • Sep 2007
        • 142

        #4
        Here
        Also
        txtInvNo.Text = rs.Fields(0) u get

        Faisal

        Originally posted by mafaisal
        Hello
        Try this
        Set rs = New ADODB.Recordset
        rs.Open "SELECT max(Inv_No) as Inv_No FROM Invoice_Master" , con, 3, 3
        txtInvNo.Text = rs!Inv_No

        set alias name for fields max(Inv_No) default it have no column name

        Comment

        • mclueless
          New Member
          • Jan 2008
          • 56

          #5
          Thanks a lot....Using alias it worked...

          Comment

          Working...