473,725 Members | 2,180 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Main Form Text Box Referencing a Subform Field

Hello Everyone,

Access 2000

I have a main form with a continuous subform. On the main form I have a
text box that references a field on the subform. What I'd like it to do is
show the value in the field of the last record entered on the subform. But
what its doing is referencing whatever record the user clicked on last
before closing all the forms. Also if the user cleared the subform field, I
would like the text box on the main form to show a null value as well.

Here is what I have for the control source of the text box on the main form

=[Forms]![frmStudentRecor d]![sfrmCommunicati on]![CommStatus]

Thanks for your help.

William
Nov 12 '05 #1
2 4764
This Control needs to be requeried to update the contents. It'll be up to
you to determine when/where that Requery should be placed in code. Offhand,
it would seem to me that it should be requeried in the AfterUpdate event of
the Control to which its Control Source refers.

Me.parent!<name ofmainformcontr ol>.Requery

Presumably, it will be requeried whenever you move to a new record on the
main form, and will reference whichever record is selected in the subform at
the time of the reference.

Larry Linson
Microsoft Access MVP

"William Wisnieski" <ww********@adm issions.umass.e du> wrote in message
news:3f******** @news-1.oit.umass.edu ...
Hello Everyone,

Access 2000

I have a main form with a continuous subform. On the main form I have a
text box that references a field on the subform. What I'd like it to do is show the value in the field of the last record entered on the subform. But what its doing is referencing whatever record the user clicked on last
before closing all the forms. Also if the user cleared the subform field, I would like the text box on the main form to show a null value as well.

Here is what I have for the control source of the text box on the main form
=[Forms]![frmStudentRecor d]![sfrmCommunicati on]![CommStatus]

Thanks for your help.

William

Nov 12 '05 #2
"William Wisnieski" <ww********@adm issions.umass.e du> wrote in message news:<3f******* *@news-1.oit.umass.edu >...
Hello Everyone,

Access 2000

I have a main form with a continuous subform. On the main form I have a
text box that references a field on the subform. What I'd like it to do is
show the value in the field of the last record entered on the subform. But
what its doing is referencing whatever record the user clicked on last
before closing all the forms. Also if the user cleared the subform field, I
would like the text box on the main form to show a null value as well.

Here is what I have for the control source of the text box on the main form

=[Forms]![frmStudentRecor d]![sfrmCommunicati on]![CommStatus]

Thanks for your help.

William


Hi -

Maybe instead of pulling the data from the subform into the main form
you should "push" it instead. Or some combination. From the subform,
on the form_insert event, push the value back onto the parent. Or
maybe use the CommStatus.Afte rUpdate event. To reach your field, you
would use Me.Parent("Name OfField"). I'm not sure what the "bang"
equivalent is. I never use them.

If it is really vital to identify the last record inserted, you need a
way of identifying it. Are you using an autonumber for the ID or key
field? That's usually a good practice, or else add a date field to
track when the record is inserted, then use a "SELECT MAX ..." sql
string for a recordset to get the value.

Hope this helps.

Phil Freihofner
Nov 12 '05 #3

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

Similar topics

2
8313
by: chris vettese | last post by:
I've been having trouble with this for a long time. I have a form that has many subforms. In the subforms I have unbound text boxes in the footer that sum a field. I want to Display this sum on the main form for each subform and then add them all together. In a book I have it gives the following example: =(Object type!!.Form!) I created an unbound text box on my main form and filled in the information in the example above and get a...
9
3336
by: William Wisnieski | last post by:
Hello Everyone, Access 2000 I have a main form with a continuous subform. On the main form I have a text field called . It gets populated based on what the user selects in a field on the sub form (code in the AfterUpdate Event). Here's the issue. If the user deletes a subform record. The field on the main form shows null even if there is a value in the preceding subform record. What I'd like it to do is immediately refresh to
4
7017
by: Dave Boyd | last post by:
Hi, I have two very similar forms each with a subform. The main form gets a few fields from the user and passes this back to a query that the subform is bound to. The requery is done when the user enters the last qualifying field on the main form. In one case this works fine, the subform shows the data the user wants to update -- which means showing all the data put in previously (ie showing this via the requery and the continuous...
2
4802
by: origin197511 | last post by:
Hello all... I'm having an issue with MSAccess 2000. I have a Form that holds records of my cartridge loads for a rifle and a subform that lists all groups that have been fired with that load. They are linked by the load_id field and when I just browse through the loads everything shows up correctly. Each recorded group is displayed on a line of the datasheet subform. However, when I filter the form for say my "Selected" flag...
3
2789
by: shumaker | last post by:
This code from the subform works for getting the value of a field of the main form named "WorkSheet": MsgBox Form_WorkSheet.Recordset.Fields("Clerk").Value Each record in the mainform datasheet called "WorkSheet" has a subform. I am trying to get the controls on the subform to reference the fields in the main form, because I think that it will resolve some of my write conflict problems by not having a recordset for the subform, and...
2
6067
by: Reginald Bal | last post by:
Hello, I created a main form with 2 subforms. In an attempt to move to the next record (or new record) on the main form I get the error " Method 'requery' of object '_Subform' failed". The database closes after answering the popup window (Microsoft Access has encounterd a problem and needs to close. .....) Does anybody has an idea why I'm having this problem?
9
8084
by: freeskier | last post by:
I am working on a form to edit student field placements. the student is selected from a combo box (cboStudent) which then populates a list box(lstPlacements) with field placements for that student. the fields are on a subform (sfrmEntryPlacements) which populate based on which placement is selected from lstPlacements. sfrmEntryPlacements is on a tab, tabFE, which is on main form frmStudentData. lstPlacements is on tabFE but not on...
2
2388
by: prakashwadhwani | last post by:
I have a (Main) form named : Stocks_Main and a Subform in that named: Stocks_Data The Subform is a continuous form There is a field in the subform called QTY_IN Now ... on the main form i.e. Stocks_Main I have set a text box to display a total of the QTY_IN control (which is on the subform). I am using the foll code as the control source for the text box
1
4285
by: tomlebold | last post by:
Having problems displaying query results from combo boxes on a sub form, which is on the same form that is used to select criteria. This has always worked form me when displaying query results on another main and sub form. The requery on the sub form and refresh comands on the main form do not work when the form is first displayed and when the selection criteria is changed. Should I be doing a refresh and then repaint of the sub form. ...
0
9401
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9257
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9176
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 most users, this new feature is actually very convenient. If you want to control the update process,...
1
6702
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6011
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4519
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4784
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3221
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2157
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.