473,569 Members | 2,872 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help opening a new form based on a field selected on a subform

I have a form with a subform on it. On my main form, you select an
employee id number and the top portion of form fills in with data, and
the bottom portion of the form,which is a subform, lists existing
records there are for that employee (one to many relationship). How
can I set up my main form, so the user can select one of the records
on the subform and retain that recordid number for use in opening a
new form and displaying the that record?

I tried creating a text field and populating it when a record is
selected (ongetfocus) - Me!Text17 = frm!frmExisting LeavesSubForm!
RecordID

Doesn't seem to work - error message - runtime error 424 - object
required. Is this the right approach or is there a better way to do
this?
Thanks.

Jul 29 '07 #1
1 1665
Put the following code in the click event of one or more fields in your
subform:

DoCmd.OpenForm "NameOfYourNewF orm",,,"[RecordID] = " & Me![RecordID

PC Datasheet
Providing Customers A Resource For Help With Access, Excel And Word
Applications
re******@pcdata sheet.com


"Coll" <co*********@ho tmail.comwrote in message
news:11******** **************@ d55g2000hsg.goo glegroups.com.. .
>I have a form with a subform on it. On my main form, you select an
employee id number and the top portion of form fills in with data, and
the bottom portion of the form,which is a subform, lists existing
records there are for that employee (one to many relationship). How
can I set up my main form, so the user can select one of the records
on the subform and retain that recordid number for use in opening a
new form and displaying the that record?

I tried creating a text field and populating it when a record is
selected (ongetfocus) - Me!Text17 = frm!frmExisting LeavesSubForm!
RecordID

Doesn't seem to work - error message - runtime error 424 - object
required. Is this the right approach or is there a better way to do
this?
Thanks.

Jul 29 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
17487
by: Dalan | last post by:
Please help - just take a quick look at the function code below. It probably just needs some minor tweaking. The function module is based on an intermediate query to provide a group record total from a subform that is posted to a field on the main form. "Everything seems to work fine" except that I consistently receive an error everytime...
3
1953
by: Earthling | last post by:
Any help would be appreciated to solve the following simple problem that I will describe. *** There is a form called "red chocolate form". The form has a particular subform field that has a checkmark box that is selectable as on or off (on if there is a checkmark inside it). The table that contains the data for the form is known as...
13
3592
by: Aladdin | last post by:
I have an MS Access form on which I have a listbox listing tables in that database. I want to be able to click on any of those tables and view its contents on the same form using subforms or any grid control. I tried many grid controls (DBGrid, DataGrid, MSFlexGrid), the ADO Data Control and everything I can think of, with no success. Here...
3
3410
by: radioman | last post by:
Hi all, I would appreciate some help please. I just need pointing in the right direction as I am at a loss. Basically I have a form (frmAddMaster) which displays two subforms "Master Stock subform" and "Client Stock Template subform". Each subform contains the following fields "Product ID,Product Description and Size". What I am trying to do...
2
2230
by: Lyn | last post by:
Hi, I am working on a genealogy project in which I have two tables: Person -- one record for each person in the family. Each record has a unique Autonum field (IDPerson). Partnerships -- one record for each marriage. Each record has a unique Autonum field (ID), and also contains two fields IDPartnerMale and IDPartnerFemale. Both of...
4
3159
by: Kathy | last post by:
What is the standard technique for handling the fields in the following scenario on a continuous form? Multiple Divisions. Each Division has multiple Buildings. Each Building has a Supervisor. Tables: (abbreviated) TblDivision DivisionID
1
303
by: El | last post by:
Please help!! I have a form and in it are several subforms. In order for users to move from the main form to the subforms there are tabs on the upper part of the form. I have one field that when data is entered on the main form, I would like that same data to move to the same field on the next subform. How do I do this?? Any suggestions...
23
2420
by: mforema | last post by:
Hi everybody, I need to create a query that will search based on keywords and major categories. My tables are set-up as follows: tblLiteratureArticles: Abbreviation(FK) ArticleID(PK) Author Title etc... tblArticleKeyword (Join Table btn tblLiteratureArticles & tblKeywords)
7
6183
by: dscarbor | last post by:
I have a simple form with 4 fields, and a subform that retrieves records that are potential matches based on a query. The user will use the ID from the subform record and enter it into one of the fields on the main form (this is how the match will be stored). Is there a way using a button/macro to populate the parent form's field with the ID...
0
7703
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8138
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7681
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7983
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5514
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5228
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1229
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
950
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.