Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Aug 2nd, 2005, 9:54 PM   #1
iown714
Newbie
 
Join Date: Aug 2005
Posts: 1
Rep Power: 0 iown714 is on a distinguished road
How to connect with VB to an Access database on another computer

Hi,
I'm trying to write just a simple VB application that runs on machine X and accesses an Access table on machine Z. I don't really want to map any drives or such thing. Machine X and Z are in the same network so they can see each other. Does anyone know what the connection string would be for the application to access the table?

Let's say that I want to retrieve all records whose customers whose first name is = "mark". The basic structure to open a db is...

Set dbsCurrent = OpenDatabase("xxxx")

... and then what??? what is the next thing that I have to do to get all the records from machine Z to machine X? What is the exact connection string that I have to use in order to access an Access database over the network?

Thank you in advance.
iown714 is offline   Reply With Quote
Old Aug 3rd, 2005, 10:45 AM   #2
Pizentios
Programming Guru
 
Pizentios's Avatar
 
Join Date: May 2004
Location: Brandon, Manitoba, Canada
Posts: 2,023
Rep Power: 7 Pizentios is on a distinguished road
Send a message via ICQ to Pizentios Send a message via MSN to Pizentios
i could be wrong but i think you need a service to run on box Z to serve the db up.

Why are you using access? there are far better db's out there (that are commercial quality) that are free (read: free as in beer). Like Postgresql and MySQL

I like postgresql myself, but many others will tell you mysql. VB will connect to these two no problem.

If you still want to use a access db, you'll need box Z to run IIS (or personal web server), and then have a DSN pointing to your db. Then connect with something like this:

Dim cnnConnection as Connection

set cnnConnection = new Connection

cnnConnection.Open "Provider=MS Remote;" _
	& "Remote Server=http://www.myserver.com;" _
	& "Data Source=MyDataSource;" _
	& "User Id=MyUserName;Password=MyPassword;"

Then all you'd have to do is run a query, and output the data or do what ever you need to do with it.

Note: You do not need to put a web address into the Remote Server Part of the connection strings, you could use something like http://192.168.0.11 or what ever the internal ip of box Z is.

Also i have no idea if you can use apache (a free and better web server IMHO) for this or not, so your on your own for that part :-)
__________________
Profanity is the one language that all programmers understand.

Check out my Blog <---updated Nov 30 2007!

Last edited by Pizentios; Aug 3rd, 2005 at 11:10 AM.
Pizentios is offline   Reply With Quote
Old Aug 3rd, 2005, 1:10 PM   #3
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,464
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
you could also map a network drive where the DB is located
__________________
http://jasonpowers.net

"There are a thousand hacking at the branches of evil to one who is striking at the root."
Infinite Recursion is offline   Reply With Quote
Old Aug 3rd, 2005, 2:05 PM   #4
Pizentios
Programming Guru
 
Pizentios's Avatar
 
Join Date: May 2004
Location: Brandon, Manitoba, Canada
Posts: 2,023
Rep Power: 7 Pizentios is on a distinguished road
Send a message via ICQ to Pizentios Send a message via MSN to Pizentios
yeah i don't think he really wants to do that though. but it would be the easyest way to do it.
__________________
Profanity is the one language that all programmers understand.

Check out my Blog <---updated Nov 30 2007!
Pizentios is offline   Reply With Quote
Old Aug 4th, 2005, 10:08 AM   #5
Rory
Expert Programmer
 
Rory's Avatar
 
Join Date: Jan 2005
Location: London
Posts: 542
Rep Power: 4 Rory is on a distinguished road
Send a message via MSN to Rory
It probably would work, but the Access DBM isn't truly multiuse (it queues requests) and has a maximum of 10 "simultaneous" users (instances of the application). Plus it's Access. Urghh!
Rory is offline   Reply With Quote
Old Aug 4th, 2005, 10:23 AM   #6
Pizentios
Programming Guru
 
Pizentios's Avatar
 
Join Date: May 2004
Location: Brandon, Manitoba, Canada
Posts: 2,023
Rep Power: 7 Pizentios is on a distinguished road
Send a message via ICQ to Pizentios Send a message via MSN to Pizentios
Yeah, which is why i suggested Postgresql or MySQL.
__________________
Profanity is the one language that all programmers understand.

Check out my Blog <---updated Nov 30 2007!
Pizentios is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 2:45 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC