?
Solved

SQL code or Visual Basic code

Posted on 2004-04-21
5
Medium Priority
?
271 Views
Last Modified: 2013-11-25
I need either SQL code or Visual Basic code to populate 2 junction tables (associative tables) in a patient treatment plan database.  

I need to insert (or add) the Patient# from the patient table and the DD_CODE_ID from the DD_CODE table into the Patient_DD_Code table.  And insert (or add) the Patient# from the patient table and the TX_Category_ID from the TX_Category table into the Patient_TXCategory table.

Do I write this code in a query or on a form with a command button?  I'm not sure where to write the code for this.

Thanks for any help you can give me.

tlm17
0
Comment
Question by:tlm17
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 17

Accepted Solution

by:
walterecook earned 252 total points
ID: 10880873
The quickest way would be to do both.
Create queries that would actually move the data (append queries)
Then you can have this code on a command button:
docmd.setwarnings false  ' turn off the notify
docmd.openquery "query1Name"
docmd.openquery "query2Name"
docmd.set warnings true ' notify back on (good idea)

Does that help?
Walt

0
 
LVL 18

Assisted Solution

by:Data-Man
Data-Man earned 248 total points
ID: 10881048
if you want the queries to run faster use the execute method of the currentdb object


CurrentDb.Execute "query1Name", dbFailOnError
CurrentDb.Execute "query2Name", dbFailOnError

Using the execute method negates the need for the two setwarnings statements.

Mike
0
 
LVL 17

Expert Comment

by:walterecook
ID: 10881164
Sure does.  Good idea dataman.
0
 
LVL 51

Expert Comment

by:Steve Bink
ID: 11956607
No comment has been added to this question in more than 21 days, so it is now classified as abandoned..
I will leave the following recommendation for this question in the Cleanup topic area:

Split - walterecook,Data-Man

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

RoutineT
EE Cleanup Volunteer

0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question