Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

using a relation in vba

Status
Not open for further replies.

newnoviceuser

Programmer
Jan 4, 2003
63
US
well things were going well but another problem this is a 2 part question.

1. im using 2 recordsets accessing 2 tables one is a transaction list each one has a code
the second is a list of what each code is and its description in my database there is a relation between the 2, but using the recordsets there is not one. how can i use the relation to automatically set the 2nd recordset to the right code that the first one was set on?

meaning when you go to a record on recordset 1 it sets recordset 2 to the same code used in recordset 1
 
question number 2 is just a geeral question.
ive been learning vba i have 3 books on vba and they are ok. but i recently discovered how much easier it is to do the same thing in vba using sql commands. none of my books cover sql that well and I can not seem to find a list of available commands that are usable in access. Does anyone know the name of a book that could explain to a novice user all of the available sql commands that can be used in access. maybe with examples?
 
1. Assuming you have MS Access, you make an Access Query and link to it via Excel using Data/Get External Data/Create Query.

2. I agree with your comments about lack of SQL information. I have, however managed to get along for 20 years by "cheating" - setting up a query in Access and using View/SQL View. Highly instructive, and easy to copy/paste into the VB Editor. There is also a lot of info in Access Help.


Regards
BrianB
** Let us know if you get something that works !
================================
 
Without more details regarding exactly what you are trying to do, and without seeing the table layouts, I can only give a generalized answer: I see two possibilities for handling your "2 recordsets" question. You could either (1) set up a "master-detail" form and set up the link there, or (2) create a query to join the two tables using the relation.

Access uses SQL in a rather straight-forward way. Most any book on SQL should help you.

Assuming you are using the "Design Mode" or the "Wizard" to set up your queries, you can always view the underlying SQL by selecting View/SQL View from the menu. Once you become famiaiar with writing your own SQL, you can even type the SQL in the SQL View and then switch back to the Design view to see how Access handles it there. (I still have to tweak the SQL myself from time to time because I can't always figure out how to "talk" to Access in the Design view.)
 
I created a query with both tables in it. and acessed it with recordset. it worked fine. how can I access a form from a seperate database. im in a database called checks.mdb i want to access the form in db1.mdb. can I do that?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top