Dim db As New Connection
'Dim tbpro As New ADODB.Recordset
'Dim db As Database
Dim tbpro As Recordset
Private Sub Command1_Click()
rsMyRecordset.Open (App.Path & "\" & "super.mdb")
rsmyreco
End Sub

Private Sub Form_Load()

'db.ConnectionString = (App.Path & "\" & "super.mdb")
'tbpro.ActiveConnection "table1", db, adOpenDynamic, adLockOptimistic
db.Open (App.Path & "super.mdb")

Set tbpro = db.OpenRecordset("table1")

End Sub
The above code can't work, It will leave an error message "Data source name is too large".
Please tell me how do i can solve it?

(App.Path & "\" & "super.mdb")

How could it work. You write a wrong syntax to assign the connection string.
You must mention the name of the provider, through which you can open the database. Your codes should be

'Declaring Variables
Dim db As New ADODB.Connection      'Database connection object
Dim tbpro As New ADODB.Recordset    'Database recordset object

Private Function getrecordset(cnnConnection As ADODB.Connection, sQry As String) As ADODB.Recordset

          'Creating a function to open a recordset object

      Dim rstrecord As ADODB.Recordset
          Set rstrecord = New ADODB.Recordset

          rstrecord.CursorType = adOpenDynamic
          rstrecord.LockType = adLockPessimistic
          rstrecord.CursorLocation = adUseClient
          rstrecord.Source = sQry
          Set rstrecord.ActiveConnection = cnnConnection
          rstrecord.Open
          Set getrecordset = rstrecord

End Function

Private Sub Command1_Click()
    'Opening connection
    db.Open

    'Initializing and opening recordset
    Set tbpro = getrecordset(db, "Write your SQL Statenment here")

    'Do Jobs to maintain your table
    'or
    'Do jobs to insert data in table
    'or
    'Do jobs to retrieve data from table

    'After doing work close recordset
    tbpro.Close
    Set tbpro = Nothing

    'Close Database connection
    db.Close

End Sub

Private Sub Form_Load()

    db.ConnectionString = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & App.Path & "\" & "super.mdb" & ";"

    Form1.Show

End Sub

Hope it help you.

hello, I wanna ask about how to add a video into visual basic 6.0
I try it once, when I insert it to the VB and delete it from my computer it cant play anymore . If I bring it back its work.
because I wanna do some project and send it "include the videos I want" to someone.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.