| | |
VB: Connect to Access database via ODBC datasource name
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Jan 2003
Posts: 5
Reputation:
Solved Threads: 0
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.
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.
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.
.NET Specialist / Webmaster, Extended64.com.
Please do not email or PM me with support questions. Please direct them to the forums instead.
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.
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.
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.
ADO would have made you life a whole lot simplier.
Last edited by Paladine; Nov 13th, 2003 at 3:39 am.
•
•
Join Date: Mar 2004
Posts: 1
Reputation:
Solved Threads: 0
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
thanks in advance
Vihang
•
•
Join Date: Jul 2004
Posts: 3
Reputation:
Solved Threads: 0
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
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
•
•
Join Date: Feb 2007
Posts: 28
Reputation:
Solved Threads: 3
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.
![]() |
Similar Threads
- how to connect ms access database to html webpage (JavaScript / DHTML / AJAX)
- Connect to access database on a shared folder (C#)
- Connect Access Database to a Website (MS Access and FileMaker Pro)
- connect to access database over network (C#)
- Writing to an Access Database (Visual Basic 4 / 5 / 6)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: crystal report 8 designing during runtime!!!
- Next Thread: Using C# library in vba
| Thread Tools | Search this Thread |
Tag cloud for Visual Basic 4 / 5 / 6
* 6 429 2007 access activex add age append application basic beginner birth bmp calculator cd cells.find click client code college column component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report retrieve save search sendbyte sites sort sql sql2008 sqlserver subroutine table tags textbox time timer urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows






