Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  HOME    TRACKER    Visual Basic

Mainframe Database Access W/vb

I am trying to connect a simple deletion application I wrote to an IBM mainframe database. I have built the form and have attempted several times to connect it to the database but with no avail. This is my first program in VB that I have needed to connec to a database. I believe I have everything installed on my machine neccessary to accomplish this. It seems the best way to do this is from my application through ADO to the mainframe and back. All I need the application to do is to run a query on an ID number entered into a text field. The program should query a database called Accident and match the number entered into the text with an accident_id number. Once the field has been queried the user should then have the ability to delete the row. Now the form is already set up with the correct sql statements I am just having trouble actually connecting to the mainframe database. Any help whatsoever would be greatly appreciated. Thank you guys and gals.

View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Mainframe FTP Via Access
Hi Guys/Girls,

I'm working on compiling some code that automates the FTP process for pulling datasets from my organization's mainframe environment. I've come up with the following Sub, but it seems overkill (using Notepad twice to compile). Can anyone offer or suggest a refined process for connecting and transfering? Thanks for your valuable insights....


Sub DoFTPTransfer()

Dim WshShell As Object
Dim MyDir As String

MyDir = "C:Data"
ID = "Joe Schmo"

' The following creates the FTP command structure in Notepad.

Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "notepad.exe", 1, False
Sleep 100
WshShell.AppActivate "Untitled - Notepad"
Sleep 100
WshShell.SendKeys "open <FTP Server Here>", 1
WshShell.SendKeys "{ENTER}", 1
WshShell.SendKeys "user " & ID, 1
WshShell.SendKeys "{ENTER}", 1
WshShell.SendKeys "get '<Dataset Name Here>' " & MyDir & "Output.txt", 1
WshShell.SendKeys "^S"
Sleep 100
SendKeys MyDir & "ftpcmds.ftp", 1
SendKeys "{TAB}", 1
SendKeys "A", 1
SendKeys "{ENTER}", 1
Sleep 100
WshShell.SendKeys "^Y" 'Handles if file already exists.
Sleep 100
WshShell.SendKeys ("%{F4}")
Set WshShell = Nothing
Sleep 100

' The following creates the BAT command to begin the FTP transfer.

Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "notepad.exe", 1, False
Sleep 100
WshShell.AppActivate "Untitled - Notepad"
Sleep 100
WshShell.SendKeys "cd " & MyDir
SendKeys "{ENTER}", 1
WshShell.SendKeys "ftp -n<" & MyDir & "ftpcmds.ftp", 1
WshShell.SendKeys "^S"
Sleep 100
SendKeys MyDir & "ftpcmds.bat", 1
SendKeys "{TAB}", 1
SendKeys "A", 1
SendKeys "{ENTER}", 1
Sleep 100
WshShell.SendKeys "^Y" 'Handles if file already exists.
Sleep 100
WshShell.SendKeys ("%{F4}")
Set WshShell = Nothing

Set WshShell = CreateObject("WScript.Shell")
WshShell.Run MyDir & "ftpcmds.bat", 1, True

Kill MyDir & "ftpcmds.bat"
Kill MyDir & "ftpcmds.ftp"

CreateObject("WScript.Shell").PopUp "FTP File Transfer Completed . . .", _
2, "Transfer Complete", 4096

End Sub

Accessing Mainframe DB2 Database From A Visual Basic Application

I am developing a Visual Basic application using VB 6.0 (fat client) and SQL Server database as the backend under Windows NT 4.0 environment

I am using SQL OLEDB for connecting to the server.

Down the line in the development process, there is a need for changing the backend database to Mainframe DB2 database

In this regard, I need help on the following:

0) Is this a difficult exercise to be carried out?If not, what is the difficulty level if I am strong in VB and not much in Mainframes.
1) What is the necessary software that I need in Windows Environment
2) How do I connect to the Mainframe DB2 database?
3) What are the changes that need to be done in the application
4) Are there any changes to be done on the DB I/O operations currently done in SQL Server environment
5) What are the other parameters that influence my current application and that needs to be handled if I have to develop in mainframe DB2?

Can anyone reply to me providing with the topology diagram with Windows NT client and the backend Mainframe with intermediate system environment details including hardware and software?

I had tried browsing the IBM side - Redbooks and other discussion forums but could not get the exact details for the above questions

I am really hard pressed for time ...

Appreciate your help and you can directly reply to my mail id NSAM@CBSINC.COM

Thanks and Regards


Getting Data From Access DB To 3270 Mainframe
I was just wondering if anyone has ever attempted to get data located on a access database located on a LAN to a mainframe terminal. I am just trying to pick off a few fields off the access db and send it in a file to the 3270 mainframe. Any ideas?

Transmit Dat From Vb/access Form To Ibm Mainframe Session
How can I transmit data from a Vb/ Access form to a IBM mainframe session. In words, I'm trying to input data into a Access form and then have a macro transmit it into the fields in the mainframe session.

Possible To Make VB App Access A Mainframe VSAM File?
I would GREATLY appreciate any assistance with this. If possible, I would like to create a VB app that looks up keys in a mainframe VSAM file. No updating of records is involved, just browsing is sufficient.

Any ideas?

Exporting Data From One MS Access Database To Another MS Access Database In Visual Basic
hello friends,
i want to transfer the data from one Access database to another Access database using visual basic.

The first Access Database name is Data1
Table Name is tbldata1
fields - ID -- Number
            venueID -- Number
            Date --- Date/Time
            RNo --- Number
            SRNo --- Number
            HNo --- Number

i want to transfer this data into the second Access Database -- Data2
with table name same & fields also the same

pls can anyone help me out with this problem


Ftp With Mainframe

I've searched high and low but I've come up empty. How do you use FTP in Visual Basic 6 to send the full range of commands to an IBM Mainframe. VB's Inet only supports a limited range (e.g. send). What about "quote" and "site"? The IBM FTP server has options that allow the FTP client to specify the type of session, for instance -- a JES session. When "quote site filetype=jes" is sent to the server, the subsequent comannds are interpreted uniquely(i.e. -- "puts" are read into the IBM's Job Entry Subsystem as a batch jobstream, and "DIR" lists the active jobs).

The problem is: HOW TO GET THE "SITE" COMMAND passed to the server. When I issue the command nothing happens. This works fine in the FTP client in DOS (Reflection's inet), but in VB in hangs.

This shows a successful DOS ftp session --- this is all that I'm trying to do in VB.

ftp> quote site filetype=jes
200 SITE command was accepted
ftp> put c:/user/ftptest/test.jcl
200 Port request OK.
125 Sending Job to JES internal reader FIXrecfm 80
250-It is known to JES as JOB27564
250 Transfer completed successfully.
ftp: 200 bytes sent in 0.05Seconds 4.00Kbytes/sec.
ftp> dir
200 Port request OK.
125 List started OK
BVEBO6Y JOB20347 OUTPUT 4 Spool Files
BVEBO6A JOB25404 OUTPUT 3 Spool Files
250 List completed successfully.
ftp: 222 bytes received in 1.92Seconds 0.12Kbytes/sec.


Using VB To Download Or FTP From A Mainframe
I have a really strange request for any ultra guru out there. I use a program called "Extra" that is used to access a mainframe datasets. Actually the datasets are created using a query program called FOCUS. I have an "Extra" macro build (that uses VB) to download datasets to files on a server. I added VB code to auto email the files through Lotus Notes.
Now I need to change the auto email code from Notes to Outlook. Simple enough but I cannot get the "Extra" macro to read the Outlook VB code but I can get Outlook itself to run an auto email Sub.
If anyone has a clue of what I am talking about, I need to get some tips on how to make VB work in macros that are not Microsoft based.
I would like to see if I can get a macro built in Outlook itself to FTP a file off a mainframe and then have Outlook email it.

If anyone can figure anything out, you must be a god.
If you response, you are a prince/princess.


Connecting Vb To Ibm Mainframe

is it possible to connect vb6 to ibm mainframe ? can anyone provide any example or resources or any link ?

thanks and regards,


How To Connect To Mainframe From VB6.0
Hi friends,

I need to connect to mainframe system from VB application and then I have to call a CICS transaction by providing some input values to the transaction.

Then the CICS transaction will provide the output values. I have to fetch those output values.

I am not supposed to directly fetch the data from Mainframe DB2 database.

Any idea how to proceed.

Thanks in advance.

Sumit Ghose

Mainframe Communication With VB6
I would like to establish a link to our s/390 mainframe using VB6. Currently it possesses a PCOMMS emulator, but we want more control than this gives at the moment.

Any ideas?


FTPing To Mainframe
I'm fairly new at VB (but quite a veteran at ASP) and my boss wanted me to develop an app to FTP files from a Client machine to a Mainframe (which, via TCP/IP, should work the same as any other server).

In ASP, I've been using a third-party component to perform the FTP, but, now, I need to write my own.

Any help you can give me as to how to write FTP code in VB would be greatly appreciated.


Mainframe Display
Has anyone used WDMFDSP.OCX to 'talk' to a mainframe display from a VB app? I can't seem to find much info. on the fine points of using this OCX.

VB To IBM Mainframe - Java Or ?

I have a very big VB 6 program that I need to have work on a PC and an IBM Mainframe. SOme one suggested that I convert the program to JAVA. I was wondering if there are any other alternatives? Also, the IBM needs only the calculations not the VB interface which I need for the PC. Can I creat a Java applet with the Cals and have it run on the PC and IBM.

Is there an easily way to convert VB 6 to Java?


Connecting To Mainframe
yeah, I was wondering if anybody could tell me how exactly I would go about getting a report from the mainframe using the Access VBA.


Mainframe Computers
I'm not an expert on these, but do mainframe computers
use OS's like Windows or do they use Unix? Would a normal
program that someone develops on a PC work on a mainframe?

VB6 And Mainframe (3270)
Does anyone know How I get VB6 to communicate (passinformation back and retrieve information) from a mainframe (3270) connection?
Or any link to good sites so I can research this topic?

Connecting Vb6 To Mainframe
can i connect vb6 to ibm mainframe using emulators.if yes,please give me an example or link to some examples ?

thanks and regards,

VB To IBM Mainframe - Java Or ?

I have a very big VB 6 program that I need to have work on a PC and an IBM Mainframe. SOme one suggested that I convert the program to JAVA. I was wondering if there are any other alternatives? Also, the IBM needs only the calculations not the VB interface which I need for the PC. Can I creat a Java applet with the Cals and have it run on the PC and IBM.

Is there an easily way to convert VB 6 to Java?


Using VB To Start A Mainframe Job
Here's an interesting challenge for anyone who would like to try. I'm using VB to start a production mainframe job. It works great with one minor annoying problem.

First I use WinInit to verify the mainframe Logon Id and password. Then I accept variable data to pass to the mainframe and FTP a text data file to the mainframe. That works well. Then I use the following files that I send to my C:Temp directory to start the mainframe job as follows.

File crdjcl.txt - this is a .txt file that looks like a mainframe job card and execute and gets sent to our mainframe scheduling system. When it receives this file it puts the m/f job in the que to start.

File crdlogon.txt

My m/f Logon Id on this line
quote site file=jes
put c: empcrdjcl.txt

File crdtomf.bat - this is a bat file to execute the above file.

I then use Shell in the VB program to execute the crdtomf.bat file as follows.

RetVal = Shell("c: empcrdtomf.bat, vbNormalFocus)

Everything works fine except I get a mainframe window requiring that I enter my password again. I've tried everything I can think of including adding my password after the logon id in the crdlogon.txt file as follows.


I've also put the password on the 2nd line which also does not work.

Nothing seems to work. This is not a crisis since the job runs ok but I would like to eliminate the cumbersome 2nd password check.

Does anyone know a better way to do this. It seems like there must be a way to send a command directly to the internal reader using FTP. Perhaps there is a way to send a site command first so that the put gets directed to the internal reader instead of just to a m/f file.

Thanks in advance for any help.


FTP Mainframe Data Set
I need to download a file (data set) from an IBM MVS mainframe.

I've tried some code snippets and I can log on to the mainframe FTP, but the directory listings are a little confusing and I can't get a file to transfer.

I don't need a GUI browser I just want to specify the specific data set to download. I'd like it in ascii, but ebcdic would suffice.

Any help would be greatly appreciated.

VB Connection To Mainframe
Please somebody tell me how to establish a connection with my VB code to access data on the mainframe.

Open A Page In MainFrame
Okay, I've tried searching and found nothing.

See the menu at the top of your web browser? The menu with file, view, edit, favorites, etc. I have made my own browser for a game and I need to know how to make those go to a specified url. The menu button is "File > News and Updates".

My main frame is called "MainWindow" (no quotes), and here is the code I have so far.

Private Sub mnuFileNews_Updates_Click()

End Sub
I need the code that goes in the middle, anyone have ideas? I figured it would be the NavigateTo function, but I don't know how to use it.

Mainframe To PC - Urgent Help Needed
I need to transfer data from a mainframe 3480 tape cartridge to a pc

Connction To Mainframe Data Via VB
Hi All

We have one system in our office which is a 'Mainframe system'. The
system gets connected to the 'Extra Personal Client' for database

I want to do some operations from VB to the mainframe database. Anybody can
tell me how should I get conncected to mainframe database via 'Extra
personal Client'.

Pls help in case anybody have worked on same.

Best Regards

How To Make Mainframe Connection
Is connecting to a mainframe system thru VB 6 possible. Has anyone out
there tried it yet. I'd be grateful for some advice and guidance.


Dairi Veapi
Analyst Programmer

FTP To OS/390 MVS Mainframe Systems Problem From VB6
I've written an FTP in VB6. I can FTP files to an OS-390 MV mainframe thru GET & PUT. There's an option I am more intereste in utilizing. The option is "SITE" or "QUOTE SITE". This optio allows the next stream of commands to be passed withou interpretation to the mainframe. Specifically, I am trying t send MVS JCL to the mainframe to execute. I can manually ente all of the FTP commands which includes the QUOTE SITE for th MVS JCL and it all works. I can programmatically put in al except the QUOTE SITE in VB code. I am using the INET object. can check return codes and is well except for the QUOTE SIT command.
Do I need to update some library to get this to work? Do I nee to be using sockets? Is the server software having problems? Can anyone suggestion anything positive here??
What happens is that the program issues the QUOTE SITE comman and never returns - it hangs. There's no response or retur codes. no extended messages from the server- nothing. I do get "still executing" status on the event.

Any help would be appreciated. A guy in London offered to sell m his code for several $K. So if you can't help please don' bother.
=================3 D================= 3D=
here's sample code:
strSite = ""
strPath = "C:Documents and SettingsauergMy DocumentsDataM ProgramsMyFTP"
strJobNm = "TESTJOB.TXT"
strFTPcmd1 = "file=jes"
strFTPcmd2 = strPath & strJobNm
strFTPcmd3 = "filetype=seq"
strFTPcmd4 = "CLOSE"
strftpcmd5 = "QUIT"
Inet1.UserName =
Inet1.Password =
Inet1.Protocol = icFTP
Inet1.RemoteHost = strSite
'Inet1.RemotePort = "80"

aMSG = Inet1.ResponseInfo
R_C = Inet1.ResponseCode


Inet1.Execute , "QUOTE SITE", strFTPcmd1, vbNull
aMSG = Inet1.ResponseInfo
R_C = Inet1.ResponseCode

'Inet1.Execute , "GET", strFTPcmd2
'aMSG = Inet1.ResponseInfo
'R_C = Inet1.ResponseCode

Inet1.Execute , "CLOSE", strFTPcmd4
aMSG = Inet1.ResponseInfo
R_C = Inet1.ResponseCode

Inet1.Execute , "QUIT", strftpcmd5
aMSG = Inet1.ResponseInfo
R_C = Inet1.ResponseCode

=================3 D================= 3D========

FTp'inf From VB To A MVS Mainframe Using The Site Command
The follow code gets the file to the Mainfrasme but in the 80 byte LREC format, I need it to land in 11 bytes (Site command?) can anyone help? I have used third party products but perfer to stay in VB or ues WS_FTP.
Thank you

Dim b() As Byte
Dim ftp As System.Net.FtpWebRequest = _
CType(FtpWebRequest.Create(URI), FtpWebRequest)

ftp.Credentials = New System.Net.NetworkCredential(logonID, password)
ftp.UseBinary = False
ftp.Method = System.Net.WebRequestMethods.Ftp.UploadFile
ftp.UsePassive() = True
Dim Stream As StreamReader = New StreamReader(vendorFileName1, _
System.Text.Encoding.ASCII, False)

b = Encoding.Default.GetBytes(Stream.ReadToEnd())
ftp.ContentLength = b.Length

Dim requestStream As Stream = ftp.GetRequestStream()

PC To Mainframe Machine(APPC)
I wanted the idea for communication between a PC with VB6 to a Mainframe machine(s390) and run the mainframe jobs in COBOL,JCL,CICS,DB2 thru APPC programs(communicate with it). please assist

Mainframe Macro Insert To Word
I am new to VB and am in need of help. Background, I have a macro written in VB that runs as a user interface to a Host Mainframe used for accounting. The macro currently writes letters in notepad, using writeline this works great, however the letter need to have the company logo printed in the corner. I have tried to use a Word template formated with everything but I cannot get VB to insert the variables (name, address ect.). These variables are entered via textboxes while the macro is running. I need help! The simpler the better, as I am new. I need to write the code as a function so all parts of the macro can use it.

ScreenScrapping TN3270 Mainframe Session

I have Windows XP.
I need to screen scrape data from a pcomm session window.
Could you pls. guide me the best way to do this.

Also if there is any other way other than using PCOMM Emulator which is faster?

Thanks In Advance,
JJ Mahesh

FTP - Returning File Lists From Mainframe In VB6
Our machines are moving from CA TCP/IP stack to IBM TCP/IP stack. The first difference I noticed was the format of the file listing returned from the "DIR" command. CA had the file name fully qualified and was listed at the beginning of the line. The IBM version spits out volume information first and only the portion of the file name not already specified in the current "directory." For example:

File name = 'DIR.SUBDIR.FILE'
Current "directory" = 'DIR'

DIR.SUBDIR.FILE volume info

volume info SUBDIR.FILE

Using wininet- FTPFindFirstFile and InternetFindNextFile works OK under the CA TCP/IP stack becaue the file name is first and always space delimited. So the filename returned in the WIN32_FIND_DATA datastructure can be easily pared down to just the real file name. However I'm struggling to find a way to extract the real file name from IBM TCP/IP stack listing because volume information may not always be consistent depending on the attributes of the file, thus moving the location of the actual file name within the returned string.

Is there a quick workaround that will still allow me to use FTPFindFirstFile and InternetFindNextFile or will I have to use something else like FTPCommand sending "ls" to get the filename information? Are there any examples of FTPCommand w/ "ls" around?


Urgent, Migrate From Mainframe To Sybase
Please give me idea on how can i migrate data from Mainframe to Sybase

Visual Basic To MainFrame Table Base
Hi All,

I need to connect Visual basic to MainFrame table base?
My requirement is, I need to query mainframe table base for getting a resultset thru VB6.

Please help me out with ur comments and any sample demo..code?
Is there any way..
After my initial research, i found i need to write an RPC which hanldes mainframe tablebase and
it returns resultSet and handles this result set in VB..
Is there any other way?..any thoughts ..plz help

Plz help..
Thanks in advance..


Reading/Writing To A Mainframe VSAM File
I'm writing a program that takes a message file (created in a VB program) and I need to send it to a mainframe VSAM file. I need to send it connecting to the mainframe via TCP/IP (the mainframe is in another state). I've read many places that say that this can be done using ADO and OLE DB, etc. , but I can't find any place to see how to setup the code. I have used ADO to send the file to a SQL database on our test server, but how to do the connection to the mainframe is eluding me.

I've only been programming with VB for a few months (a mainframer thrown into the client/server ocean ) so I'd appreciate it if someone could point my nose in the right direction.



Calling An Excel Macro From An Access Database That Refers To That Database

i have a macro in excel that inserts some values into a table in a database in access, but i want to make it so i dont have to touch the excel file, instead i have a module in the access file that calls the sub in the excel file, but then i get an error saying that the database is already there a way of getting around this?



How To Link Remote MySQL Database To Local Access Database?
i try to create Access DB, and link some tables from remote MySQL DB to this local DB.

it's very easy to do it manually.
could any one tell me how to do it in VB program?
Thank you so much!

Transferring VB Project From Access Database To SQL Server Database

I have been working on a project at my employer to bring a current program that is run by a third-party company, in-house so that we can run it ourselves instead of paying out monthly fees to the third-party company.

The basics of the program are fairly simple. However, after getting the code about 90-95% done, I am realizing that my Access database will quickly become too small to use. I know we have SQL Server on at least one of our servers, and am thinking about trying to use that instead of Access.

My question is, how hard would it be to transfer my project to a SQL Server database instead of an Access database? I am using ADO to connect to my Access database right now. Would I have to make any adjustments to my VB code? I realize some of the SQL in the code will need to be adjusted, but what about my cn. and rs. lines of code (connections and recordsets)?

Shame on me for not realizing Access's size limitations before now. Any information that anyone can provide is greatly appreciated. Thank you in advance.

Convert Access Database To Works Database Via Code?
Does anyone know of a way to convert an access 2000 database to a msworks database via VB6 code? ANY suggestions are welcome. TIA.

How To Import MySql-database Table To Access-database
I'm building a client-database in .NET for my work and I'll have the program copying rows of data from the online MySQL-database to a local offline Access-database. Everything looks alright when opening the local database in Access but when opening it in my app I get an error saying that the index or primary keys will conflict because of duplicates. I have tried endlessly to switch primary keys, creating new ones but nothing seems to help. Any suggestions?

How To Save And Access Images, Sound And Video Files In MS Access Database.
How to save and access images, sound and video files in MS Access database using front end as VB.

Can anyone help me ?

Thank You.

Open Access Form From A Password Protected Access Database Through VB
Iam using a password protected Access database. I can open the database with out any problem. There is a startup Access form associated with this database. I would like to open this form with out any prompt to the user for the password. When the program is run, the database opens twice. The first instance with the login screen prompting the user for the password. The second instance opens as desired. How to overcome this problem with the program opening the form only once.

Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Private Declare Function GetKeyboardState Lib "user32" (pbKeyState As Byte) As Long
Private Const VK_NUMLOCK = &H90
Private Const VK_SCROLL = &H91
Private Const VK_CAPITAL = &H14
Private Const KEYEVENTF_KEYUP = &H2

Private Sub SafeSendkeys(ByVal keys As String, Optional bWait As Variant)
Dim keysBefore(0 To 255) As Byte
Dim keysAfter(0 To 255) As Byte
Call GetKeyboardState(keysBefore(0))

If IsMissing(bWait) Then
Call SendKeys(keys, False)
Call SendKeys(keys, CBool(bWait))
End If
Call GetKeyboardState(keysAfter(0))

If keysBefore(VK_NUMLOCK) <> keysAfter(VK_NUMLOCK) Then
End If
If keysBefore(VK_CAPITAL) <> keysAfter(VK_CAPITAL) Then
End If

If keysBefore(VK_SCROLL) <> keysAfter(VK_SCROLL) Then
End If

End Sub
'Under a click event I have:
UserApps(AppAP).appRunPath = "C: estdb1.mdb"
If UserApps(AppAP).appAvailable = True Then LaunchFile (UserApps(AppAP).appRunPath)
hApp = FindWindow(vbNullString, "Password Required")
Call SetForegroundWindow(hApp)

Call SafeSendkeys("password", True)
Call SafeSendkeys("{Enter}", True)
What is wrong in my code?

Thanks in advance.

How To Open An Access Form From A Password Protected Access Database?
I have a password protected access database. I can open this database. Though the startup form (Access form) comes up, the database opens twice. One instance with the login screen for the password (since the database is password protected) and the other opens properly with the form. Can any one help in opening without the first instance occuring?

UserApps(AppAP).appRunPath = "c: estdb.mdb"
If UserApps(AppAP).appAvailable = True Then LaunchFile (UserApps(AppAP).appRunPath)
(AppAP).appRunPath, "password")
hApp = FindWindow(vbNullString, "Password Required")
Call SetForegroundWindow(hApp)
Call SafeSendkeys("password", True)
Call SafeSendkeys("{Enter}", True)

Thanks in advance,

Shared Access To An Access 2000 Database In A Network Directory

My application (a VB executable) uses a Microsoft Access database to store various information entered by the user. The application and the database are located on the network so many users can access it simultaneously. Just recently, I implemented persistent connections so the database connection remains open for the entire life of the application (which speeds things up considerably compared to connecting every time something needs to be done). Since then, only one user seems to be able to connect at any single time. As far as I know, Access allows about 20-30 simultaneous user connections without a problem (and can do much more), so why does it lock the database exclusively? The application is loaded into the memory of every user's computer, so each user should use only their own connection object.

Here's the code I use to connect:


Set m_DbConnection = New ADODB.Connection
With m_DbConnection
sDSN = "Provider=Microsoft.Jet.OLEDB.4.0;"
sDSN = sDSN & "Data Source=" & sDb & ";"
sDSN = sDSN & "Persist Security Info=True"

.ConnectionString = sDSN
.CommandTimeout = 8 'wait 8 secs before exiting commands
.ConnectionTimeout = 15
.CursorLocation = adUseClient
.IsolationLevel = 4096
.Mode = adModeShareDenyNone Or adModeReadWrite
End With

Exit Function
If Err.Number = -2147467259 Then 'Cannot open database (either doesn't exist or locked)
Dim vErr As ADODB.Error
If Not (m_DbConnection Is Nothing) Then
If m_DbConnection.Errors.Count > 0 Then
For Each vErr In m_DbConnection.Errors
HandleError ERR_LOG_DETAIL_LONG Or ERR_TARGET_LOG, vErr.Number, vErr.Description & " (native error: " & vErr.NativeError & ")", vErr.Source, "basDb::PrepareConnection"
Next vErr
HandleError ERR_LOG_DETAIL_LONG Or ERR_TARGET_LOG, Err.Number, Err.Description, Err.Source, "basDb::PrepareConnection"
End If
HandleError ERR_LOG_DETAIL_LONG Or ERR_TARGET_LOG, Err.Number, Err.Description, Err.Source, "basDb::PrepareConnection"
End If
DisplayDetailedError Err.Number, Err.Description, Err.Source, "basDb::PrepareConnection"
End If
Resume PROC_Exit


If another user already connected to the db, I get this error:

Error #-2147467259: Unable to use ''; file is already in use. (native error: -67044352, minor error code: -1024, major error code: -1024, Jet IDA Number (DAO Error): 3045) [source Microsoft JET Database Engine, procedure basDb::PrepareConnection]

(the first error is an ADO error, the native error is what the data provider returns, and other things are just what I got after doing a few searches on MSDN).

I first thought that the problem is about the Mode property setting of the connection object, but MSDN describes adModeShareDenyNone constant as the less restrictive, full database sharing mode, and combining it with adModeReadWrite seems the most logical solution to allow others to read/write data. I even tried to remove it (leaving only adModeReadWrite), but the same thing took place.

I tried to change the CursorLocation property to adUseServer, but it had no effect.

I tried updating the version of MDAC to 2.6, but to no avail.

Have any of you had the same problem or knows the solution? I will appreciate any help I can get!

Thanks a lot in advance!


Get The Path Of An Access Database From The Database Object?
If I use the following code to open a database in a code module:
Code:Function ConnectMDB(dbPath As String, dbName As String, objTmpDB As Database) As Boolean
    On Error Resume Next
    Set objTmpDB = OpenDatabase(dbPath & dbName, _
        Connect:="Driver={Microsoft Access Driver (*.mdb)};" & _
    If Err.Number = 0 Then
        ConnectMDB = True
    End If
    On Error GoTo 0
End Function

And call it using:
Code: If ConnectMDB(dbPath, dbName, dbKB) = False Then

Can I later get the system path of the database file from the object "dbKB"? Reason: I use the dbKB object thruought my userform which is loaded much later, but I need to know the path of the database without creating an additional userform property.

+--VB Dot Net
+-- Navman GPS Forums @

Simultaneous MS Access Database Access Problem Using VB6 Program.
am using MS Access database by a vb6 program for multiuser environment.
In the program I have written code for autogenerating employee_id which is primary key in the table.
When entering records simultaneously from two or more workstation,
It gives a problem

Run time error
The changes you requested to the table were not successful because they would create duplicate values in the primary key, or relationship. Change the data in the field or fields that contain duplicate data, remove the index, or redefine the index to permit duplicate entries and try again.

How to resolve it.
Is there any way to restrict the database from accessing when record appending goes on by other workstation.

My ActiveX Inside Access Database... How To Access The Tables?
how to access the tables in access databse from within the database?

Any Ideas?

Can You Use An HTML Form To Access A Microsoft Access Database?
Can you use an HTML form to access a Microsoft Access Database?

How Do I Access A Linked Table On A Passworded Access Database?
i have 2 passworded databases, one named db1.mdb and db2.mdb, db1.mdb is the main one and has linked tables from db2.mdb in it. If i open db1.mdb it asks for a password so i put the password 'test' in and it opens ok. I can access tables within db1.mdb but if i click on a linked table contained within db2.mdb it says not a valid password. The same thing happend when i try to access it the same way with code. How do i access linked tables with code? im using now the code below and it says invalis password because of the above reason.

dim db as database
dim rs as recordset

set db=opendatabase("c:db1.mdb",False,False,"MS Access;pwd=test")
set rs=db.openrecordset("table1")

'table1' is a linked table and contained in db2.mdb and it wont let me access it. Anyone got any ideas?

Copyright 2005-08, All rights reserved