VB: Connect to Access database via ODBC datasource name

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Jan 2003
Posts: 5
Reputation: ChristinaOrchid is an unknown quantity at this point 
Solved Threads: 0
ChristinaOrchid ChristinaOrchid is offline Offline
Newbie Poster
 
0
  #11
Jan 20th, 2003
Hi Tekmaven,

First of all, I don't see the file type "Access database" in my Excel Worksheet.

Secondly, I don't want to access my database manually like you propose File/Open....etc.. I need to program it by clicking on a button, the user can recuperate datas in a table and display them on the Excel worksheet.
Reply With Quote Quick reply to this message  
Join Date: Feb 2002
Posts: 898
Reputation: Tekmaven is a glorious beacon of light Tekmaven is a glorious beacon of light Tekmaven is a glorious beacon of light Tekmaven is a glorious beacon of light Tekmaven is a glorious beacon of light 
Solved Threads: 27
Moderator
Tekmaven's Avatar
Tekmaven Tekmaven is offline Offline
The C# Man, Myth, Legend
 
0
  #12
Jan 20th, 2003
Then why are you using Excel? Why not just use Access? You can accomplish this by creating a "Form".
-Ryan Hoffman

.NET Specialist / Webmaster, Extended64.com.
Please do not email or PM me with support questions. Please direct them to the forums instead.
Reply With Quote Quick reply to this message  
Join Date: Jan 2003
Posts: 5
Reputation: ChristinaOrchid is an unknown quantity at this point 
Solved Threads: 0
ChristinaOrchid ChristinaOrchid is offline Offline
Newbie Poster
 
0
  #13
Jan 20th, 2003
Hi Tekmaven,

Because I have a lots of calculation in my project and Excel is a good tool and easy way for me to do it :p)
Reply With Quote Quick reply to this message  
Join Date: Feb 2002
Posts: 1,135
Reputation: samaru is just really nice samaru is just really nice samaru is just really nice samaru is just really nice 
Solved Threads: 5
Team Colleague
samaru's Avatar
samaru samaru is offline Offline
a.k.a inscissor
 
0
  #14
Jan 22nd, 2003
Well, if you want to synchronize Access information from an Excel sheet (Which is what I think you want to do), you don't need any code. Synchronizing it with a sheet automatically sounds like a much better way to
go rather than a button that does it (unless you want to do call a vbscript, but it's not necessary in this case). A user can just go to the sheet and it'll be there. I've done this before, but not in Excel 7.0.

If you want to synchronize a sheet in your workbook with output from an ODBC datasource, go to the menu Data -> Get External Data -> New Database Query. If you don't have Microsoft Query, you might be asked to insert the CD and install this feature. If it all goes well, you should get a window where you get to pick a data source. Choose one you created and click ok. After that, you'll get another window where you can pick what columns you want. Select what columns and click on the -> button. Click next. The following dialogs are
self explanatory (sort by, etc.). The last dialog (Query Wizard - Finish) you can select "Return Data to Microsoft Excel." You can save the query if you want to by pressing on the button "Save Query." Click on finish.

After you do all that, you'll get a dialog that says "Returning External Data to Microsoft Excel." Select existing worksheet (assuming it's blank). Click ok. The information will be imported to your current sheet. The data is dynamic however. Any change you do in your ODBC database, it will update in Excel automatically. You can right click and hit Refresh. If you want you can right click on one of the fields and go to External Data Range Properties. There you can control the Refresh rate.
Check out my blog at http://www.shinylight.com for more stuff about web dev.
Reply With Quote Quick reply to this message  
Join Date: Feb 2002
Posts: 1,135
Reputation: samaru is just really nice samaru is just really nice samaru is just really nice samaru is just really nice 
Solved Threads: 5
Team Colleague
samaru's Avatar
samaru samaru is offline Offline
a.k.a inscissor
 
0
  #15
Jan 22nd, 2003
I hope what you want is NOT a client in Excel to insert information into an Access database. There are better solutions than trying to do this, but something like that can be done.
Reply With Quote Quick reply to this message  
Join Date: Nov 2003
Posts: 1
Reputation: rmundkowsky is an unknown quantity at this point 
Solved Threads: 0
rmundkowsky rmundkowsky is offline Offline
Newbie Poster

Re: VB: Connect to Access database via ODBC datasource name

 
0
  #16
Nov 12th, 2003
This is probably a little too late for your project, but here is the answer (that was a pain to hack):

Set DB = WS.OpenDatabase("", False, False, "DSN=BLAH_NAME;SRVR=TCP/IP:blah_host.com:BLAH_SID;UID=BLAH_USER;PWD=BLAH_PASSWORD")

The false, false are what makes this work.

Hope that helps
Reply With Quote Quick reply to this message  
Join Date: Feb 2003
Posts: 793
Reputation: Paladine has a spectacular aura about Paladine has a spectacular aura about Paladine has a spectacular aura about 
Solved Threads: 26
Team Colleague
Paladine's Avatar
Paladine Paladine is offline Offline
Master Poster

Re: VB: Connect to Access database via ODBC datasource name

 
0
  #17
Nov 13th, 2003
Hmm, I am curious, what version of Access are you trying to connect to? You say you are using Excel 97, but what version of Access? And why are you using DAO to connect via ODBC instead of ADO ?

ADO would have made you life a whole lot simplier.
Last edited by Paladine; Nov 13th, 2003 at 3:39 am.
Assistant Manager, Pharmacy Informatics
Wordpress Learning Blog
Updated : ASP.Net Login Code
Reply With Quote Quick reply to this message  
Join Date: Mar 2004
Posts: 1
Reputation: vihang1 is an unknown quantity at this point 
Solved Threads: 0
vihang1 vihang1 is offline Offline
Newbie Poster

VB: Connect to Access database via ODBC datasource name

 
0
  #18
Mar 2nd, 2004
I am new to VB.Net and have a question. I am trying to connect VB.Net to Access. What I want to do is , when i select the database name, I want to popup the tables in the database...when one of the table is seleted, then the fields in the table should pop up...Can someone tell me how to go about it .

thanks in advance

Vihang
Reply With Quote Quick reply to this message  
Join Date: Jul 2004
Posts: 3
Reputation: yadi is an unknown quantity at this point 
Solved Threads: 0
yadi yadi is offline Offline
Newbie Poster

Re: VB: Connect to Access database via ODBC datasource name

 
0
  #19
Jan 6th, 2005
I’ve got a problem with this program.It only saves one data at time.What shall I do with it?
Private Sub cmdsave_Click()


Adodcprog.Recordset.MoveNext


And with this program I couldn’t search a data I wanted.Pls somebody help me!
End Sub
Private Sub cmdsearch_Click()
Dim stremployeeName As String
Dim strpaysheet As Variant
stremployeeName = InputBox("Please enter empid")
strpaysheet = datPrimaryRS.Recordset.Paysheet
datPrimaryRS.Recordset.Find "CompanyName Like " & _
Chr(39) & stremployeeName & "*" & Chr(39)
If datPrimaryRS.Recordset.EOF Then
datPrimaryRS.Recordset.Paysheet = strpaysheet
MsgBox stremployeeName & " not found."
End If
End Sub
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 28
Reputation: mjwest10 is an unknown quantity at this point 
Solved Threads: 3
mjwest10 mjwest10 is offline Offline
Light Poster

Re: VB: Connect to Access database via ODBC datasource name

 
0
  #20
Mar 3rd, 2007
Check this out: Visual Basic Database Guide. It explains in detail how to connect to different databases (including Microsoft Access, SQL, Oracle). I think it should help you get a great understanding of VB and data access.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



Tag cloud for Visual Basic 4 / 5 / 6
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC