•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Visual Basic 4 / 5 / 6 section within the Software Development category of DaniWeb, a massive community of 423,610 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,174 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums
Views: 5106 | Replies: 6
![]() |
•
•
Join Date: Apr 2007
Posts: 69
Reputation:
Rep Power: 2
Solved Threads: 9
I have a VB6 application that uses DAO to read and write MS Access files. Since the program uses Access files exclusives, it was written in DAO instead of ADO. The recordsets within the program are based on queries in the database. I need to add a field to the table and query. I'm sure I can figure out testing for the existence of the field in. My question: How can I add a new field to the table AND query?
•
•
Join Date: Jul 2007
Posts: 37
Reputation:
Rep Power: 2
Solved Threads: 3
Pls i also need to know how to use DAO instead of ADO Because i know a bit of ADO Connection and am seeking to know as a fresh user of DAO connect to the Database, You can email some few example if present OR send the site that give tutorial on either online or ebooks pls send the detail to the address below
atplerry@yahoo.com
atplerry@yahoo.com
•
•
•
•
I have a VB6 application that uses DAO to read and write MS Access files. Since the program uses Access files exclusives, it was written in DAO instead of ADO. The recordsets within the program are based on queries in the database. I need to add a field to the table and query. I'm sure I can figure out testing for the existence of the field in. My question: How can I add a new field to the table AND query?
check this sample code in the attachment.
hope this will be able to give u some idea.
regards
Shouvik
Shouvik_The_Expert_Coder
Have a problem? Don't worry just give me a call and I'll fix it for you.
Have a problem? Don't worry just give me a call and I'll fix it for you.
•
•
•
•
Pls i also need to know how to use DAO instead of ADO Because i know a bit of ADO Connection and am seeking to know as a fresh user of DAO connect to the Database, You can email some few example if present OR send the site that give tutorial on either online or ebooks pls send the detail to the address below
atplerry@yahoo.com
check out this sample project.
it was created in DAO technique and it has everything u need to know about connecting the database using DAO object and frequently used database operations.
regards
Shouvik
Shouvik_The_Expert_Coder
Have a problem? Don't worry just give me a call and I'll fix it for you.
Have a problem? Don't worry just give me a call and I'll fix it for you.
•
•
Join Date: Apr 2007
Posts: 69
Reputation:
Rep Power: 2
Solved Threads: 9
Ok, I figured out how to add a field to an existing table with DAO
Now the question is, how do I add the new field "Address2" to existing queries in the database? The database contains a query call "Agency Query." I need to add Address2 to this query.
Thanks for any help.
Set dbsAccess = DBEngine.Workspaces(0).OpenDatabase(dbFile$, False, False)
'Agencies is a table in the Access database
Set td = dbsAccess.TableDefs("Agencies")
'Address2 is the field to be added
Set fd = td.CreateField("Address2", dbText, 50)
td.Fields.Append fd
dbsAccess.CloseNow the question is, how do I add the new field "Address2" to existing queries in the database? The database contains a query call "Agency Query." I need to add Address2 to this query.
Thanks for any help.
•
•
Join Date: Apr 2007
Posts: 69
Reputation:
Rep Power: 2
Solved Threads: 9
Nevermind... I figured it out. Using SQL of the QueryDefs overwrites the original query in the database with the new one. This thread can be closed.
Set dbsAccess = DBEngine.Workspaces(0).OpenDatabase(dbFile$, False, False)
Set qd = dbsAccess.QueryDefs("Agency Query")
qd.SQL = "SELECT...
dbsAccess.Close•
•
•
•
Nevermind... I figured it out. Using SQL of the QueryDefs overwrites the original query in the database with the new one. This thread can be closed.
Set dbsAccess = DBEngine.Workspaces(0).OpenDatabase(dbFile$, False, False) Set qd = dbsAccess.QueryDefs("Agency Query") qd.SQL = "SELECT... dbsAccess.Close
if you have benefited from the reply then post a feedback and mark the thread as solved.
Shouvik_The_Expert_Coder
Have a problem? Don't worry just give me a call and I'll fix it for you.
Have a problem? Don't worry just give me a call and I'll fix it for you.
![]() |
•
•
•
•
•
•
•
•
DaniWeb Visual Basic 4 / 5 / 6 Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Adding a field to an existing MSSQL table with SQL query (MS SQL)
- How to check if BLOB field is NULL or Not in a Table ? (Oracle)
- tables (PHP)
- Need SQL Help (VB6 and Access) (Visual Basic 4 / 5 / 6)
- MySql multiple table query problem.... (MySQL)
- Add an attribute to existing table (Database Design)
- VB6 and MS Access 2002 (Visual Basic 4 / 5 / 6)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: Pro.. Can i have ur moment..
- Next Thread: VB Advanced TEXT BOX problems


Linear Mode