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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Accessing an Access DB w/a workgroup

Status
Not open for further replies.

meckeard

Programmer
Aug 17, 2001
619
US
Hi All,

I need to write a small VB 6 app that will pull data from an Access 97 DB and create a CSV file. But in order to access the data, you must be part of the workgroup with the appropriate permissions.

Has anyone done anything like this before? How do I allow VB to access the data while it uses the workgroup?

Thanks,
Mark
 
Mark-

I had a simmilar project. Here is the code I used to connect.

On Error GoTo GetData_Err
Dim db As Connection, strvar As String
Dim dbcmd As Command, rst As Recordset
Dim db2 As Connection
Dim dbcmd2 As Command, rst2 As Recordset
Dim intMark As Integer
Dim intDia As Integer
Dim intSys As Integer

'EISNER
Dim intEisPtID As Long
Dim strFnm As String
Dim strLnm As String
Dim strID As String
blnEisPres = False
'gets patient id
Set dbcmd2 = New Command
Set db2 = New Connection
db2.CursorLocation = adUseClient
db2.Provider = "Microsoft.Jet.OLEDB.4.0;"
db2.Properties("Jet OLEDB:System database") = _
"x:\data\eisner\database\secured.mdw"
MsgBox "connect to eisner"
db2.Open "Data Source=e:\cpaDatabase\RiskData.mdb;User Id=xxxx;Password=xxxxx;"
dbcmd2.ActiveConnection = db2
'build and run query
strvar = " (PrimaryMRN = '" & strPtID1 & "' or SecondaryMRN = '" & strPtID1 & "' )"
dbcmd2.CommandText = "select [PatientID], [PrimaryMRN], [SecondaryMRN], [Last Name], [First Name], [AliasLast] from tblpatientinfo where " & strvar
dbcmd2.CommandType = adCmdText
MsgBox "open eisner qry"
Set rst2 = dbcmd2.Execute
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top