473,473 Members | 1,900 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Linking records in two tables

56 New Member
I have 2 tables, tblParticipantDetails and tblPreCourseQ - both have ParticipantID in them and this links the tables in relationships. ParticipantID is the primary key (and an autonumber) in tblParticipantDetails and is a number (long integer) in tblPreCourseQ. I want the ParticipantID to update in tblPreCourseQ with the same number as assigned by the autonumber ParticpantID in tblParticpantDetails. Data is entered via forms (frmParticpantDetails and frmPreCourseQ - source is tables as above) - frmPreCourseQ is opened from a command button on frmParticpantDetails using a macro. Is there anyway I can have ParticpantID fill in frm and tblPreCourseQ when a new record is opened from frmParticpantDetails?

I know I could use a subform but don't really want to do this as I have 3 instances where I want to do this and don't want to put everything in one table.

thanks
Mar 11 '09 #1
5 1218
Megalog
378 Recognized Expert Contributor
In the Open event for the form that is bound to tblPreCourseQ (frmPreCourseQ) , you can do the following:

Expand|Select|Wrap|Line Numbers
  1. On Error Resume Next
  2. If Me.newrecord then
  3.     Me.txtParticipantID = [Forms]![frmParticipantDetails].[txtParticipantID]
  4. End If
Mar 11 '09 #2
luciegiles
56 New Member
What do you mean by Open event?
Mar 11 '09 #3
luciegiles
56 New Member
No problem - done it as follows
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Load()
  2.  
  3. On Error Resume Next
  4. If Me.NewRecord Then
  5.     Me.ParticipantID = [Forms]![frmParticipantDetails].[ParticipantID]
  6. End If
  7.  
  8. End Sub
thanks for your help
Mar 11 '09 #4
NeoPa
32,556 Recognized Expert Moderator MVP
To avoid setting the form as dirty (when it thinks that changes have been made and need to be either saved or discarded) I would suggest rather to set the Default property to the value required rather than the Value property.
Mar 11 '09 #5
Megalog
378 Recognized Expert Contributor
Yeah I meant Load event.. The coffee hasnt kicked in yet this morning =)

That code should work fine as long as the frmParticipantDetails form is always open whenever frmPreCourseQ is loaded.
Mar 11 '09 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Gianfranco | last post by:
Hi I got a problem with 2 tables. I have a table, say A, with x records, coming from a make table query and a table, say B, with y records, coming from another make table query. I need to join...
3
by: Rob Davis | last post by:
I am familiar with VBA and the manual method of attaching/linking external data tables (File, Get External Data etc). I am also familiar with opening tables which exist in the current Access file,...
14
by: diskoduro | last post by:
Hi!! Years ago I built a database to control the production of a little factory. The users wanted to work in a Windows Net workgroup so I created an mdb with all the tables and data an after...
0
by: gasturbtec | last post by:
please help im new at access programming and i just got this project dropped in my lap because the old programmer quit. i've been doing ok so far but now i need to add code to an existing database...
2
by: Salad | last post by:
OS = WinXP & Win98. Access = A97 & AXP Q1) Where can I find the VFP ODBC driver at Microsoft. I have been working developing an app in Access that will link to some DOS FoxPro tables. I...
2
by: TheTamdino | last post by:
One of the things that is common between most genealogy databases is that they will have one screen were you log all the information for a given person and then (maybe) have a link to a source...
11
by: dskillingstad | last post by:
I've been struggling with this problem for some time and have tried multiple solutions with no luck. Let me start with, I'm a novice at Access and I'm not looking for someones help to design my...
6
by: davegb | last post by:
I've searched here and in the help screens, but I can't find the answer to a very simple question. How do I create a specific link between 2 records in 2 different tables? I know how to use the...
1
by: hmiller | last post by:
I'm sorry to populate the server with yet another question about linking multiple tables and queries, howerver I have not been able to find the right criteria. My problem. I am trying to...
5
by: MontainDoctor | last post by:
Hi Folks I have a database in dbase. The dbf tables have numerous indexes because of which the linking is not possible. What to do? Rakesh
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.