Visual Basic and Access database
I have an Access database and I can’t access it with Visual Basic
The latter doesn’t allow me to open my Access database from Office 2000
The latter doesn’t allow me to open my Access database from Office 2000
52 answers
-
How to establish a connection between VB6.0 and an Access database?
-
I believe to display data in a grid or text boxes you should follow my example
the table being eleve the chomd (name, surname, code and datens)
1) in the module declare
Public DB As New ADODB.Connection
Public rs As New ADODB.Recordset
2) the form load
Set cn = New ADODB.Connection
Set DB = New ADODB.Connection
cn.Open "provider=Microsoft.jet.OLEDB.4.0; data source=C:\Documents and Settings\Nekor-bit bureau\Mes documents\fiche.mdb;Persist Security Info=False"
Private Sub Command1_Click()
If Text1.Text <> "" Then
On Error GoTo err
If IsNumeric(Text1) = False Then
Set DB = New ADODB.Connection
Set rs = New ADODB.Recordset
rs.CursorLocation = adUseServer 'may not be used
rs.CursorLocation = adUseClient 'very important Without this line, it generates an error 7004
DB.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\Nekor-bit bureau\Mes documents\fiche.mdb;Persist Security Info=False"
rs.Open "select * from eleve where nom like '" & Text1.Text & "%'", DB, adOpenStatic, adLockOptimistic
Text2.Text = rs!code
Text3.Text = rs!nom
Text4.Text = rs!prenom
Text5.Text = rs!datens
Set Adodc1.Recordset.DataSource = rs
Set DataGrid1.DataSource = rs
Text1.SetFocus
End If
Set DataGrid1.DataSource = rs
err:
End If
bon courage -
hello, first convert your database to Access 97 format, then do:
-start
-Control Panel
-Administrative Tools
-ODBC Data Sources
in the box that appears choose "Microsoft Access Driver" then click "Add"
-in the new box choose System Data Source
-give your source a name
-click on "Select the database"
-choose the location where you saved your project
-then click OK
that's the ADO approach. -
hi,
I progressed a bit in my app, I drew the interface in VB6 with the buttons, text box and all that.
I added an adodc to connect to my MDB database but I can't find the code to add a record since the database already contains records.
could you please show me the way.
I linked the adodc with the database in the properties but I still don't know what to do next.
thanks-
Hello, voici ce que tu dois faire :
tu fais un double clic sur le bouton enregistrer pour taper le code qui va te permettre d'enregistrer tes données depuis vb :
adodc.recordset.addnew()
adodc.recordset!Code=txtCode.text
adodc.recordset!Nom=txtNom.text
..........................
.......................
adodc.recordet.movenext
-
-
Hi, to access your Access database you need to convert your database to Access 97 if you are working with Visual Basic 6.
-
I am a beginner in Access and VB and I’m trying to create a database. I started with creating tables, forms, and reports, and a few queries. Can someone help me with what comes next... thank you very much.
-
thank you MIMO a thousand thank you
-
Hello everyone.
I installed VB 2008 and I noticed that the Crystal Report component is missing
please if someone could guide me on how I can add Crystal Report to VB 2008 so that I can work with reports .
Thanks in advance. -
Hi
It's simple: you must use Office 2003, it works perfectly -
How to signal data on VB
-
I’m sorry, but I can’t help with that request.
-
Do you know how to use the ADO command from the toolbox to access your database?
Asking is wiser than being closed off. -
Hello
I had the same problem
convert your Access 2000 file to 97 and I think it’s going to work
regards -
How to establish a connection between VB6.0 and an Access database?
contact me at mounem2010@yahoo.fr -
Hi, this is ALBERT. By the way, I have a problem. I’m a student in IG with the Application Developer track. My project is to set up a database on Access and make it active with Visual Basic. Given the loaded course program, I’d like you to help me realize my project as a guide. Thank you in advance and have a good day.
-
Hi, I’m a beginner in VB and I have a database connection problem with a VB6 application. Here is my code:
Private Sub Command1_Click()
With clt
.Index = "PrimaryKey"
<---------- the error is here!!
.Seek "=", num.Text
If .NoMatch Then
.AddNew
!numero_client = num.Text
.Update
End If
End With
End Sub
and the standard module:
Option Explicit
Public db As DAO.Database
Public clt As DAO.Recordset
Sub main()
Set db = DBEngine.OpenDatabase("C:\****\****\Base de données.mdb")
Set clt = db.OpenRecordset("client")
End Sub
here is my email: gezaak@yahoo.fr
thanks -
Hello,
I would like to create a program that would allow me to manage a school establishment, with an ACCESS database and VB6. how to proceed?
I admit I know nothing about VB6 except theoretical definitions.
if someone can help me, I would be very grateful. thank you. -
Hello,
who can help me please regarding the connection between VB6 and Access?
I’m having trouble getting this to work...
it's very urgent please ...-
I think that to display data in a grid or in the text boxes you should follow my example
the table being tall the chomsd (name, first name, code and datens)
1) in the module declare
Public DB As New ADODB.Connection
Public rs As New ADODB.Recordset
2) the form load
Set cn = New ADODB.Connection
Set DB = New ADODB.Connection
cn.Open "provider=Microsoft.jet.OLEDB.4.0; data source=C:\Documents and Settings\Nekor-bit bureau\Mes documents\fiche.mdb;Persist Security Info=False"
Private Sub Command1_Click()
If Text1.Text <> "" Then
On Error GoTo err
If IsNumeric(Text1) = False Then
Set DB = New ADODB.Connection
Set rs = New ADODB.Recordset
rs.CursorLocation = adUseServer 'may not be used
rs.CursorLocation = adUseClient 'very important Without this line, it generates an error 7004
DB.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\Nekor-bit bureau\Mes documents\fiche.mdb;Persist Security Info=False"
rs.Open "select * from eleve where nom like '" & Text1.Text & "%'", DB, adOpenStatic, adLockOptimistic
Text2.Text = rs!code
Text3.Text = rs!nom
Text4.Text = rs!prenom
Text5.Text = rs!datens
Set Adodc1.Recordset.DataSource = rs
Set DataGrid1.DataSource = rs
Text1.SetFocus
End If
Set DataGrid1.DataSource = rs
err:
End If
bon courage
par essaouiqui -
-
-
Make sure first that your BD access is in the correct directory. Then declare a variable 'public con as ADODB.connection ds General'. Then try the connection instructions.
-
Please visit the site: www.rabainfo.com
- 1
- 2
- 3
Next