Top DevX Stories
Creating Custom Export Filters for StarOffice with XSLT
WPF Wonders: Using DataTemplates
Crystal Reports Family Offers Options for Developers
Avaya Aura Session Manager video
Avaya Aura Overview video
Search the forums:

Go Back   DevX.com Forums > DevX Developer Forums > VB Classic

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 10-16-2009, 08:15 AM
tibois tibois is offline
Registered User
 
Join Date: Jan 2004
Posts: 20
Opening Access in Exclusive mode

Is it possible to access Access in exclusive mode on the same machine VB is running on or the code below is for server use only? I tried to open it on a connection string submitting the right password but I keep getting an error message stating that the password submitted is wrong.

Here is the code used:

strConn = "User ID=Admin;Password=Pword;Data Source=" & App.Path & _
"\Access.mdb;Provider=Microsoft.Jet.OLEDB.4.o"

Thanks,

tibois
Reply With Quote
  #2  
Old 10-16-2009, 09:48 AM
Hack's Avatar
Hack Hack is offline
Super Moderator
 
Join Date: Apr 2007
Location: Sterling Heights, Michigan
Posts: 7,719
I have never seen a connection string where the uid and password were the first two elements. They are always the last two.

Move them to the end of your connection string and try again.
__________________
I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
Please use [Code]your code goes in here[/Code] tags when posting code.
Before posting your question, did you look here?
Got a question on Linux? Visit our Linux sister site.
Modifications Required For VB6 Apps To Work On Vista

Microsoft MVP 2005/2006/2007/2008/2009
Reply With Quote
  #3  
Old 10-16-2009, 10:17 AM
Phil Weber Phil Weber is offline
Super Moderator
 
Join Date: Nov 2003
Location: Portland, OR
Posts: 8,171
The last character of the Provider should be a zero, not the letter 'o'. That is, change this:

Provider=Microsoft.Jet.OLEDB.4.o

to this:

Provider=Microsoft.Jet.OLEDB.4.0
__________________
Phil Weber
http://www.philweber.com

Please post questions to the forums, where others may benefit.
I do not offer free assistance by e-mail. Thank you!
Reply With Quote
  #4  
Old 10-16-2009, 02:01 PM
gibra's Avatar
gibra gibra is offline
Registered User
 
Join Date: Mar 2009
Location: Italy - Breganze (VI)
Posts: 75
Quote:
Originally Posted by tibois View Post
Is it possible to access Access in exclusive mode on the same machine VB is running on or the code below is for server use only? I tried to open it on a connection string submitting the right password but I keep getting an error message stating that the password submitted is wrong.

Here is the code used:

strConn = "User ID=Admin;Password=Pword;Data Source=" & App.Path & _
"\Access.mdb;Provider=Microsoft.Jet.OLEDB.4.o"
"User ID" and "Password" are only related to Microsoft Access environment, NOT tu database.
In VB 6.0, you can open a database password protected by set then
Code:
Jet OLEDB:Database Password
property, while "User ID" is not matter.

Example:
Code:
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
App.Path & "\Access.mdb;Persist Security Info=False;Jet OLEDB:Database Password=Pword
To open in exclusive mode, simply set the connection Mode property:
Code:
CN.Mode =adModeShareExclusive
Reply With Quote
  #5  
Old 10-18-2009, 04:36 PM
tibois tibois is offline
Registered User
 
Join Date: Jan 2004
Posts: 20
Thanks gibra! I just stopped by to do additional research and saw your post; the code works.

tibois
Reply With Quote
  #6  
Old 10-28-2009, 04:25 AM
RobDog888's Avatar
RobDog888 RobDog888 is offline
Super Moderator
 
Join Date: Mar 2005
Location: Los Angeles, Calif. AKA: Gangsta Yoda™
Posts: 454
There is a connectionstring syntax for specifying Exclusive mode upon connecting in case you wanted to specify it in one line of code.

Use the ODBC Driver format/syntax.
Code:
oCnn.Connectionstring = "Driver={Microsoft Access Driver (*.mdb)};Dbq=" & App.Path & "\Access.mdb;Exclusive=1;Uid=Admin;Pwd=Pword;"
__________________
VB/Office Guru™ (AKA: Gangsta Yoda®)
I dont answer code questions via PMs.
Microsoft MVP 2006 & 2007
Office Development FAQ (VBA, VB 6, VB.NET, C#)
Software Developer MCP (VB 6 & .NET)
Save Ana Reps & Rating PostsVS.NET on Vista (New)Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6Outlook Global Address ListAPI Viewer utility •
Reply With Quote
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel App opening in Browser Window, how to access menus? OwenDavies VB Classic 0 03-09-2006 09:40 PM
Borland and me: We both want less code and more pictures! Mike Mitchell .NET 60 09-13-2002 06:41 PM
VBA Access 97 on an Access 2000 PC Walter Freeman VB Classic 3 06-19-2002 04:13 AM
Will MDAC 2.5 mess up an Access 2 or 95 Developers PC ?? David Lewinski VB Classic 0 07-26-2001 05:10 PM
Opening a password protected Access Database Greg Rothlander VB Classic 1 01-03-2001 03:10 PM


All times are GMT -4. The time now is 12:11 AM.


Sponsored Links



Acceptable Use Policy

internet.comMediabistrojusttechjobs.comGraphics.com

WebMediaBrands Corporate Info


Advertise | Newsletters | Feedback | Submit News

Legal Notices | Licensing | Permissions | Privacy Policy


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.