Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2004
    Posts
    5

    Lightbulb Unanswered: Starting Counter in vb ,Access as back end

    Iam using VB6 ADO & i want to start a counter from one & so on.
    Suppose i want to store the Patient Numbers .I want
    that when the form is load automatically i can see 1 in the Label box.
    I use the following query with VB6 & Oracle (SQL) as back end.It works fine
    but i want to do it Microsoft Access.In my opinion MS Access does't recognize NVL function. So how can i solve my
    problem ? The Code gernerate a Run time error
    which is as under.


    Runtime error '-2147217900(80040e14)':
    [Microsft][ODBC Microsoft Access driver ] Undefined Function 'NVL'
    in expression.

    My code is as under

    Private Sub Form_Load()

    Set RST = cn.Execute("Select NVL(Max(Roll),0)+1 as C from Student")
    If Not IsNull(RST.Fields("C")) Then
    lblPid_value.Caption = RST.Fields("C").Value
    Else
    lblPid_value.Caption = 1
    End If
    RST.Close

    End Sub

    Thnaks for your kind Cooperation

  2. #2
    Join Date
    Jan 2004
    Posts
    10
    Runtime error '-2147217900(80040e14)':
    [Microsft][ODBC Microsoft Access driver ] Undefined Function 'NVL'
    in expression.


    The problem is the driver you use in connecting thru Access..
    It should be..
    Provider=Microsoft.Jet.OLEDB.4.0;Data Source=(YOUR DATABASE FILE PATH);Persist Security Info=False.

    you can use it as your connection string to your connection..

    cn.connectionstring = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=(YOUR DATABASE FILE PATH);Persist Security Info=False."
    cn.open

    then open your table by using ado recordset using this connection.

Posting Permissions

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