Get Subform's Control In The Main Form.

Feb 21, 2005

Lets say I have Form A and Subform A with the parent-child relationship established that works well. Subform A has a Text box control that is getting display when I include the subform in Form A.


Now, I decided I dont want to include subform A in the Form A. Is there a way for me to show the contents of that Text box control in Form A without attaching the subform in the main form (Form A)?

I read somewhere that to refer a control on a subform, I have to use the code - Forms!mainform!subform.form!control. But this would be in VBA. What is the equivalent of this in a Control Source in the main form?

If I have not explained myself correctly, please do let me know.

To summarize, my question is without including the subform, I want to reference the values of the subform in the mainform. (I have some design necessity for this requirement) Is there a way for this?

thanks!

View Replies


ADVERTISEMENT

Forms :: CBO From Main Form To Reference Control On Subform

Mar 12, 2013

Ok, this is what I have:

I have setup my main form with 2 subforms to mimic a split form; this works fine.

To search for a record, I am using a cbo on the main form which I would like the user to select from. Once selected, then this will populate the first subform.

This is the code I have for the cbo:

Dim intAnswer As Integer
If IsNull(Me!cboCaseNoCFDWit) Then Exit Sub
With Me!sfFocus.Form.RecordsetClone
.FindFirst "Me!sfFocus.Form!CaseNumber = """ & Me!cboCaseNoCFDWit & """"
If Not .NoMatch Then
If Me.Dirty Then Me.Dirty = False

[Code] ....

I get an error at the .findfirst; states that the Microsoft Engine does not recogize Me!sfFocus.Form!CaseNumber

And the reason I am not using a regular split form is because I cannot, get the form to the size that I want. The splitform works great with the code above (a few changes to it of course), but the bottom of the splitform (datasheet) is too long and I cannot shorten it.

View 2 Replies View Related

Forms :: How To Refer To A Control From Subform To Main Form

Feb 5, 2015

I have Main Form is named MainFrm and it has

two Sub Forms :
- OrdersSubFrm
- DetSubFrm

I want :

if OrdersSubFrm is not contains any records DetSubFrm is not enabled

View 7 Replies View Related

Forms :: Reference Control On Main Form From Subform

Apr 2, 2014

I have a Main form 'frmEmployeeInjury' with a subform 'frmInjuryDetails'.On the subform is a date field 'dteDateofInjury' and on the main form a command button 'SaveRecord'

What I am trying to do is hide the command button on the main form until a date is entered in the 'dteDateofInjury' field.I have looked online and found information on main form and subform referencing, but I can't follow it very well without examples.

Code:

Private Sub dteDateofInjury_AfterUpdate()
Me.Forms![frmEmployeeInjury]![SaveRecord].Enabled
'Me.Parent.cmdSaveNewInjury.Visable
'Me.Parent.cmdSaveNewInjury.Enabled
End Sub

But I get 'method or data member not found'.

View 3 Replies View Related

Modules & VBA :: Unable To SetFocus On Main Form Control From Subform

Jan 13, 2015

I'm using form with subform. Main form header contain a combobox. I need to check the combobox is null or not before update a subform filed. If combobox is null then its back to Main form combobox from subform. The code below that I'm trying to:

Code:
Private Sub AssignTo_BeforeUpdate(Cancel As Integer)
If IsNull(Forms!frmDepartmentReview!cboDepartment) Then
MsgBox "You must select Department first", vbInformation
Forms![frmDepartmentReview]![cboDepartment].SetFocus
End If
End Sub

Then I'm getting 2110 run time error

Access can't move the focus to the control cboDepartment.

View 4 Replies View Related

Forms :: Textbox On Main Form Referring To Subform Control

Aug 14, 2014

I have a form with a subform which resides in a tabbed control. In that subform, I have a textbox in the footer that sums values in the detail section of the subform.

I have a textbox on my main form that should display the same data that is in my subform footer textbox, but it is giving me the #name? error.

This is the expression in my subform footer textbox (which returns the correct result):

TxtSubtotalHQPCalc -
=Sum([ActualHQPCalc])

And the expression in my main form textbox (which returns #name?):

txtActualHQPValue -
=([subfrmHQPProject].[Form]![TxtSubtotalHQPCalc])

I have verified that my subform name and textbox names are all accurate. This is very frustrating because I am using this exact same method in a different database with no problems!

View 3 Replies View Related

Forms :: Requery Control On Subform From Main Form - Refresh List?

Sep 8, 2014

I have a form called Add New Delegation, i have combo box of Institution names on the main form and a subform for Agreements discussed. with a combo box called agreements. I successfully cascaded the combo boxes so that the agreements discussed on the subform are filtered by their respective institutions on the main form. However i am unable to refresh the list each time a new institution is selected as the Macro will not allow me to requery a control on the mainform from the subform..

View 2 Replies View Related

General :: VBA Error Referring Control Field In Subform Using Main Form

Feb 22, 2013

I believe I did this before awhile ago but for some reason I keep getting an error.

I have a Mainform (frmMain) that has a Subform (frmSub). On frmSub I have 2 comboxes (strCom1 & strCom2) one is set to invisible (strCom2.Visible = No).

So using the "On Open Event" of frmMain I want make strCom2 visible if strCom1 = "Read Only". Ofcourse I will also need to place the vba on the On After Update event. Below is what I have so far but doesnt work.

I get Run-time Error 2427 "You enetered an experssion that has no value"

Code:

Private Sub Form_Open(Cancel As Integer)
If Me!frmSub.Form!strCom1.Value = "Read Only" Then
Me!frmSub.Form!strCom2.Visible = True
Else
Me!frmSub.Form!strCom2.Visible = False
End If
End Sub

View 5 Replies View Related

Problem Updating Main Form Control From Subform In Access 2003 Project (ADP)

Nov 30, 2005

I'm supporting some Access/VBA code which includes the following behavior:

When an update is made in a (linked) child form, the current date/time is written to a textbox on the main form via

Me.Parent!txtMod = Now

Likewise, the BeforeUpdate event of the main form updates the same field (and then does a bunch of form validity checks, possibly followed by a Save).

When we upgraded to Access 2003 from Access 2000, a problem erupted:

When the user returns to the main form (by clicking on any control outside the subform), the following message is issued: "This record has been changed by another user since you started editing it (etc.)..."

At this point the user must choose between "Save Record", "Copy to Clipboard" and "Drop Changes".

Conceptually, I see why this is happening (though I wonder why Access 2000 didn't flag it). The subform is the "other user". When the main form is returned to, it is "Dirty" (unsaved update), so the main form's BeforeUpdate event fires, and attempts to update the field again (Me.txtMod = Now). Since there is a pending change to the field, an error dialog pops up.

As a quick fix, I replaced the code in the subform with a flag ("Hey, I've been updated!"), which the main form checks on the Exit event of the subform control. But that seems a horrible solution. Surely there's a better way?

Notes:

1. It would be preferable to have the timestamp updated right away by the subform, though having it updated when the subform loses focus is better than nothing.

2. Since a subform is a control from the main form's perspective, I'm surprised that a change to that control doesn't render the main form "Dirty". I guess from a database standpoint it makes sense (the form's table isn't getting updated at all; just the subform's). But then, how does the main form know that the subform has been updated?

3. I tried catching the error via Form_Error. I can make the dialog not appear via "Response = acDataErrContinue", but unfortunately it defaults to dropping the changes (old and new), rather than saving the new.

View 14 Replies View Related

Why Is Main Form Update Event Triggered When Subform Dirties Main Form?

Dec 1, 2005

I have a subform which makes a change to a field on the main form. When focus is returned to the main form, the BeforeUpdate and AfterUpdate events fire. Why? I thought from the form's perspective, the subform is just another control.

BTW, I get the same behavior if I modify the field from within the Exit event of the subform control.

In either case, the main form's Dirty event is NOT triggered.

View 2 Replies View Related

Forms :: Subform - Combo Box List Not Populating According To Main Control

Apr 17, 2014

I am using MS Access 2010, I have three tables,

Policies (Id, Client Id, Address, Policy Amount, Paid)
Payments (Id, Client Id, Total Amount)
Payment Details (Payment Id, Policy Id, Paid Amount)

I have created a form "PAYMENTS" that include a sub form "PAYMENT DETAILS".

In the sub form control Policy Id is defined as combo box, and retrieving the list from Policies and Payments where Policies.Client=Payments.Client the query of Combo Box is as follows:

Code:

SELECT POLICIES.[POLICY ID]
FROM POLICIES
WHERE (((POLICIES.PAID)=False) AND ((POLICIES.CLIENT)=[Forms]![PAYMENTS]![ClientId]));

Only first time Combo Box display the Policy Ids according to the Client, but when I change the client and always displays the previous clients Policy Ids.

how to retrieve correct list of Policy Ids according to the Input Client in Payments.Client control

View 4 Replies View Related

Requery Subform From Another Subform Both Connected To Main Form

Aug 8, 2014

I have a main form that has two subforms, subform1 and subform2, both connected to the main form. When I enter data into a field in subform1 I want subform2 to requery and update to show the calculated results from the new or changed data in subform1.

I found that if I do a refresh it works when changing the data but not when entering a new line of data in subform1. I tried some code in the after update field of on subform1, but cannot seem to get anything to work.

Me.[subform2].Form.Requery

Does not work. It errors and says it cannot recognize subform2 as a field. I have tried a field name on subform2 but I still got the same error.

View 1 Replies View Related

General :: Link Parent / Child Node To A Control On Main Form In Treeview

Oct 7, 2012

I downloaded a sample treeview application I have modified most of its to suit my need, except one thing. I want link parent/child node the main form to the main form through a subform on the CategoryID.

The following is the original code where when a child not is clicked only pops up a "linked" msgbox. I need to modify the part of the code on the Select Case "C" in red:

Code:
'----------------------------
Sub DisplayForm(i As Integer)
'----------------------------
' for this Treeview I do not want a double-click on a parent node
' to open the applicable Category form, but pressing the shift key
' should open the marriage form applicable to the parent node. Shift
' or double-click on a child node should open the applicable
' offence form.

Dim strKey As String
Dim strTag As String
Dim strFilter As String

[Code] ....

View 1 Replies View Related

Replacing Running Total From Subforms Control To Main Form Table Field

Jun 11, 2015

I have an access form (Customer) along with a sub-form (Work_done). On sub-form I have Running sum of Amount in Text box-1. I want that Total of Running sum be replaced with Main form's tables field total_amount. Is it possible that we can replace an amount of control of sub-form into main form's field?

View 1 Replies View Related

Returning To Main Form From Subform

Apr 25, 2005

Hi,

I've a form that has 2 subforms - which subform is used is dependant on the selection of a combo box in the main form. After much time spend trying to set this up I am happy to report that this section works fine.

My problem is that when I have completed the subform I am not able to continue tabbing through the rest of the form.

Any help would be great,

thanks
Barry

View 1 Replies View Related

Tabbing From A Subform To Main Form

Jun 29, 2005

everytime i try to tab from my subform, it creates a new record for that subform. Also, about the subform, the control that links the main form and sub form is unique.
I have now set my Cycle property on my subforms and forms to Current Record. How can I tab from the subform to the main form and vice versa?

Thanks!

View 1 Replies View Related

Main Form Update To Subform Value

Sep 2, 2005

hi

i have a main form, which has a subform (subform1)

subform1 has a further subfrom (subform2)

in the subform2, i have a value, which on a double click, i wish the main form critical value to refresh to

thereby the main form refreshes to the value of the subform 2 value

i cannot work out the code, you may have guessed from the description of the question, i am a bit of a novice.

could anybody assist, please

View 2 Replies View Related

Main Form And Subform Issue

Oct 21, 2005

Hi, I have this main form, "frmMainPatient" and I am trying to add in another Main form "frmFim2" as a subform into frmMainPatient. I am running into some issues. Can someone take a look and tell me what I am doing wrong. Thank you,

View 2 Replies View Related

Filter Main Form From Subform

Nov 16, 2005

I have a main form that contains basic project information, and one of many subforms that contains project manager and contract information. (forms and subs linked by project ID) My project managers want to have the ability to only show project records that are theirs. I can make a filter based on any field in the main form without a problem using code like below.

Dim strFilter As String
strFilter = "ILFID Like '*FME*'"
Me.Filter = strFilter
Me.FilterOn = True

How do I write a filter to reference the project manager field in a subform that will actually filter the main form and subform records?

Thanks!

View 7 Replies View Related

Tabbing Between Main Form And Subform

Nov 18, 2005

Hello all,

This is my first post to these forums, however I have leeched so much information off of all you guys that I can't even begin to express my gratitude. So, now, onto my problem...
I'm developing a form for our call centre people to enter information regarding customer returns. Customer orders are placed on one of two systems. In my form, when the person is entering info, I have a drop down box to choose between the two systems, which calls up a respective subform to enter system-specific information. The problem I have is that I can use tab to enter the subform, however I can't use it to get out. There are two records in the subform - order date and order number. After I enter info into these 2 textboxes and try to tab out, it seems that the subform goes to a new record. How can I get my form to tab into the next required field on the main form? Hopefully this makes sense, I just read through it and its kinda questionable. Thank you very much in advance.

View 1 Replies View Related

Query Subform From Main Form

May 11, 2005

I have a main form with 5 fields (I'd like to be able to use any number of them) that I want to use to run a query against that is contained in a subform. What is the best way to go about this?

View 1 Replies View Related

How Do I Link A Subform To The Main Form?

Oct 24, 2005

Hi,
I have set up a database for my company which holds records to all the companies that we have as clients. I have created a main form and a subform. The main form is where all the particulars of the companies are entered, and the subform is like a preview window of the companies. By right, when i click on one of the records in the subform, it should reflect in the main form, enabling me to add on additional information using the fields in the main form (i have some features in the main form that should be used to record the informatio), but I just do not know how to go about doing that. is there a way to link the subform to the main form, such that when i click on the past records in the subform, it will reflect on the main form for me to edit? Any help is appreciated.

View 6 Replies View Related

Forms :: How To Get Main Form With Subform

Sep 27, 2013

i have a main form for customers and a subform for sites which is set to locked so its displayed as just a list. I have a button on my main form to add a new site for the current customer displayed..How can i get the Main form '1CustomerDetails' with subform '2SiteList' to automatically refresh one i've clicked the save button on another form.

View 1 Replies View Related

Subform Query On Main Form

Dec 3, 2014

I have created a 1 to many database. One employee table with personal details and then tables reflecting costs like, flights, accommodation, visa costs etc.I then created a query(total costs) to add up the total of those tables and then a subform that I inserted in the main form that just display the total over cost.

When I click, new record, everything goes blank which is perfect for me to input a new record but the total of the 1st record( i only have one record at the moment) remains the same.

View 8 Replies View Related

Combo Box Synchronization Between Main Form And Subform?

Jul 17, 2005

I have a main form with a subform. On my main form, I have a combo box set to "find a record on my subform, based on what I select in the combo box." This works great! At the same time, I want to use this main form combo box to synchronize with a combo box in the subform to display a value based upon the value selected in the main form's combo box. I have tried several things and searched Access newsgroups without success. I am using MS Access 2002, producing an Access 2000 database. Has anyone got any ideas? I could really use some help. Thank-You.

Denny G. :confused:

View 5 Replies View Related

Procedure Behaves On Main Form, But Not On The SubForm

Jul 25, 2005

I have a form with a subform and on the form and also on the subform, I have three comboboxes or txtboxes and in the OnExit event I have a little procedure which makes sure that each have been filled in or it asks if you want to cancell and if yes, it setfocus on the cmdCancell and then I can canells the records, and the procedure looks like this:
Me!QCTypes_Label.ForeColor = 0 'Change Label Color to Black
Dim Response As VbMsgBoxResult
If Len(Nz(Me.QCTypes, "")) = 0 Then 'If QC Type is Blank
Response = MsgBox("No QC Type Was Entered," & vbCrLf & "Do You Want to Cancel QCA.", vbYesNo + vbDefaultButton2, "No?")
If Response = vbYes Then
Me.cmdCancell.SetFocus 'SetFocus on cmdCancell
Exit Sub 'Exit Immediately
Else
Me!QCTypes_Label.ForeColor = 33023 'Change Label Color to Orange
Cancel = True 'Re-Enter QC Type, same field
End If
End If
Now the main form works great, but the subform acts strange, when I select YES, instead of cancelling and closing like the main form, this one does each procedure for each of the other two procedures. Why does it work right on the main and not on the subform? Thank you in advance for any assistnace rendered. :eek:

View 14 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved