Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening Access database without Access??

Status
Not open for further replies.

jmlady

Programmer
Nov 20, 2003
19
0
0
US
I have an db in Access, and Im in the process of designing a program that will Open the db; The catch is, I dont' want to load Access.

Is there a way to Open the .mdb file through Visual Basic without having to load access to add/remove/edit data? or is there a way to just load the forms from the .mdb?

Also, does anyone know of any good tutorials of API, ADO, DAO, etc?

Thanks again,
jmlady
 
Wow, that's a toughy.

I think it can be done with ADO - you can insert, update, delete. I don't think you'll be able to use the forms though.

There is a plethora of ADO tutorials on the net. Do a Google search.
 
It can be done with ADO and DAO

But, as RoguePoet01 says, you won't be able to use Access forms this way, just the data
 
Hi,
Am currently using these commands to access a table:

Dim dbs As Database, rcd As Recordset,qry As String

Set dbs = DBEngine.OpenDatabase("c:\project\stockdata.mdb")
qry = "select username, password from login "
Set rcd = dbs.OpenRecordset(qry)

I can navigate in the recordset using the commands such as findfirst, movenext, etc.

I opened the recordser based on a query such as "select username,......login"

I hope that this helps you.
James
 
Hi,
I use this code I my program. I'm still using VB5. Please note that you need to have Microsoft ActiveX Data Objects 2.?? (I have 2.7) referenced in your program to get this to work. You can download the components from Microsoft (MDAC_TYP.EXE)
Obviously you have to change the mdb, records etc. to match your mdb.
Hope this helps....
Hans


''''''''''''''''''''''****************************''''''''''

' IN A MODULE
Option Explicit

Public connParkcontrol As New ADODB.Connection
Public adoRsCurrent As New ADODB.Recordset



' IN THE MAIN PROG
' to update or add a new record
Public Sub GoSavePatrolDetailsData()

connParkcontrol.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & PathToDB & "/parkcontrol.mdb"

connParkcontrol.Open

sqlHoldSearch = "FROM [PATROL_DETAILS]"
' we open the whole recordset or otherwise we use the string used to search with
' to access the record reqd
adoRsCurrent.Source = "SELECT * " & sqlHoldSearch

adoRsCurrent.CursorType = adOpenDynamic
adoRsCurrent.LockType = adLockPessimistic
adoRsCurrent.ActiveConnection = connParkcontrol
adoRsCurrent.Open

With adoRsCurrent
' get the database initiaLISED
If UsePatrolDetailsForInput = True Then .AddNew ' addnew instead of update

!Patrol_ID = PassTheLog
!Date = PassLongDate
!Reserve = PassReserve
!Div_ID = PassDivision

'..............................etc

!PatrolTeam7 = PassPatrolTeam(7)
.Update ' update the file

End With

' close ADO here
CloseADOConnPilan

end Sub


' to read data from a record
Private Sub GetThePatrolDetailsData()

connParkcontrol.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" _
& PathToDB & "/parkcontrol.mdb"
connParkcontrol.Open

sqlHoldSearch = "FROM [PATROL_DETAILS]"
adoRsCurrent.Source = "SELECT * " & sqlHoldSearch

adoRsCurrent.CursorType = adOpenForwardOnly
adoRsCurrent.ActiveConnection = connParkcontrol
adoRsCurrent.Open

' move to record
With adoRsCurrent
'put the data into the fields
PassTheAutoID = !Auto_Id
PassTheLog = !Patrol_ID
PassLongDate = !Date
PassReserve = !Reserve
PassDivision = !Div_ID

'..............................etc

PassPatrolTeam(7) = !PatrolTeam7
End With

' close ADO here
CloseADOConnPilan

end Sub


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top