Visual Basic and Access database
salima
-
jamal_ho -
jamal_ho -
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
- 1
- 2
- 3
Next
-
How to establish a connection between VB6.0 and an Access database?
-
Hi, I just read this forum but I still can't link my Access database with VB6. I have a database made up of 4 tables and some queries. I want, using VB, to display some fields from the table, modify them, delete and add records, insert statistics already calculated by the Access queries... thank you for any help and I would like you to send me courses that you consider interesting. Thanks for everything
-
Hi, if possible I’d like to have effective courses with examples on databases created with VB6 and Access.
-
Hello,
I’m developing a VB6 application on a Windows 2000 platform that is specific to a company, and I can’t connect to the Access 2000 database I created. It tells me it doesn’t recognize the database format. I’ve tried with other codes but nothing works. Can you help me?
Here is the message “Connection failed, please try again”
I’m sending you the code I used:
Option Explicit
'Global variable declarations
'Global DbName As String
Global Liberreur As String
'Global OK As Integer
Public Cnx As New ADODB.Connection
Public Rst As New ADODB.Recordset
Public Cmd As New ADODB.Command
Sub main()
'This procedure calls the function to open the DB and shows the home window.
If OuvrirBase = True Then
frmConnexion.Show
Else
MsgBox ("La connexion n'a pas réussi,réessayez")
End If
End Sub
Public Function OuvrirBase() As Boolean
'This function opens the Access 2000 DB
On Error GoTo Erreur
Cnx.Provider = "Microsoft.Jet.Oledb.4.0"
Cnx.ConnectionString = App.Path & "c:\db1.mdb"
Cnx.Open
Cmd.ActiveConnection = Cnx
OuvrirBase = True
Exit Function
'\\gbemich\\GESPARC\\Application\\
Erreur:
Liberreur = "Erreur d'ouverture de la Base"
OuvrirBase = False
End Function
Public Sub OuvrirRecord(StrSQL As String)
'This procedure opens all tables of the DB. This code means to open a table, you must pass a SQL query, i.e. a ''select''
'Look in the help for these properties to see what they do
Cmd.ActiveConnection = Cnx
Cmd.CommandText = StrSQL
Rst.CursorLocation = adUseClient
Rst.CursorType = adOpenDynamic
Rst.LockType = adLockPessimistic
Rst.Open Cmd
End Sub
Public Sub FermerRecord()
'This procedure closes all tables of the DB
On Error Resume Next
Rst.Close
Set Rst = Nothing
Set Rst = New ADODB.Recordset
End Sub
Public Sub FermerBase()
'This procedure closes the DB
On Error Resume Next
Cnx.Close
Set Cnx = Nothing
End Sub-
-
-
-
YOU MUST CONVERT YOUR DATABASE TO 97 FORMAT
UNDER ACCESS
STEPS:
CLICK ON TOOLS MENU
DATABASE UTILITIES
CONVERT DATABASE TO 97 FORMAT
you give the file a name
in this case you will have 2 databases
* 2000 format
* format 97
in vb:
DATA properties
DATABASENAME: connect to the database format 97 because the DATA control does not recognize the 2000 format
-
-
Hello everyone
how can I display an image on the entire form in VB
because when I do it it doesn't display on the form, part of it remains -
Contact me at ghost_dog_jr@hotmail.com and I will give you a tutorial, and tips if you want, because it's a bit long to explain...
-
Ok Salima, first of all, when you open VB under the Project menu -> References -> check Microsoft DAO 2.5/3.51 compatibility library.
Then in the programming editor, type the following lines of code:
dim cnx as adodb.connection
dim cmd as adodb.command
dim rs as adodb.recordset
under the form_load() procedure, type:
set cnx=new adodb.connection
set cmd=new adodb.command
set rs=new adodb.recordset
cnx.Provider="Microsoft.jet.oledb.4.0"
cnx.connectionstring="your database that must be in the project folder.mdb"
rs.cursorlocation=adUseClient
rs.cursortype=adopenDynamic
rs.locktype=adlockPessimistic
rs.open cmd
I wish you good luck and stay strong
Best regards -
Hello
If you have the program that connects VB with Access, could you post it to: srigovich@hotmail.com
Thanks in advance -
Hi,
To avoid some crashes, you need to convert your database to ACCESS 97.
Run a test to see.
See you later -
First of all I thank you for your response, it’s very kind of you, and this solution, I’ve already tried it and it works, but the Office installed on the machines is version 2000, so I still can’t convert every time, that’s not professional, and I don’t understand why Office 2000 is less performant than version 97.
-
I usually work with VB and Access, send me your code to see
*you put a DATA control
*a DBGRID
or not
example
you declare it as follows
SET MO (the name of the variable you will work with) as Database = "the path to your database"
SET moo as Database.Recordset = "the name of the table"-
THANK YOU VERY MUCH I AM A BEGINNER IN VB AND I CREATED A SMALL PROJECT OF CIVIL SERVANTS IN WHICH THERE ARE ALL THE INFORMATIONS NAME FIRST NAME ETC... WITH THE PHOTO FOR WHICH I FOUND THE PROBLEM AT THE MOMENT OF THE JOIN OF A NEW RECORD IT IS FOR THIS REASON I ASK YOU TO HELP ME FIND HOW TO INSERT AN IMAGE USING A BUTTON ADD AN IMAGE THANK YOU A SECOND TIME MOUMEN RAHAL
-
-
-
-
Hello Moh
In Visual Basic I linked my program to the Access 2000 database via the Data control, but it reports a database access error, which is really surprising since it works very well with Access 97, I don’t understand anymore, I hope you can help me, I’m counting on you
See you soon on the net -
sorry but the data must be changed it is incompatible with Access2000
and if you want more explanation about the problem you can contact me at my email address to get more details about your problem, A+ -
hi everyone,
I would like to know some basic functions that would allow me to manipulate an Access 2003 database with Visual C.
well, thanks to all who will help us^^
see you soon. -
you need to convert your database to Access 97 format; for that, in Access go to Tools, Database Utilities, then perform the conversion and attach it to the VB project. good luck
-
-
listen I don’t know how to tell you this well explain your problem clearly I have always worked with VB and Access databases so if you want help shed some light on your problem
-
hi Salma
to be able to connect to a Access 2000 database you must use the Microsoft DAO 3.6 OCX:
in the Project menu click on the References tab and try to find it in the list of checkboxes
if you don't find it try to search using Windows search utility to know its path, then come back to your References tab and click Browse to locate your OCX and add it. good luck
my email: hanshans26@hotmail.com
in case you want to tell me something because I only connect rarely-
I'm really struggling,
For two days I’m not making progress on my project: I have a problem with boolean variables. When I add a member, there’s no issue: it stores correctly in the database, but for data I entered myself from Access, I can’t get it to appear in the button options. I’ve tried True/False, yes/no, -1/0, false/true... please help me!!!!!!!!!!!!!!!!
-
- 1
- 2
- 3
Next