Solved

SQL code or Visual Basic code

Posted on 2004-04-21
5
253 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 63 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 62 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 50

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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
print previewing the record showing on the form 4 51
Format a text field as percent 12 56
Microsoft Access report help 4 38
Speed up Select Top n... Query 9 37
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

752 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