473,322 Members | 1,379 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

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]![frmStudentRecord]![sfrmCommunication]![CommStatus]

Thanks for your help.

William
Nov 12 '05 #1
2 4688
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!<nameofmainformcontrol>.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********@admissions.umass.edu> 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]![frmStudentRecord]![sfrmCommunication]![CommStatus]

Thanks for your help.

William

Nov 12 '05 #2
"William Wisnieski" <ww********@admissions.umass.edu> 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]![frmStudentRecord]![sfrmCommunication]![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.AfterUpdate event. To reach your field, you
would use Me.Parent("NameOfField"). 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
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...
9
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...
4
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...
2
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. ...
3
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...
2
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...
9
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....
2
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....
1
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.