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 Replies
ADVERTISEMENT
Sep 27, 2006
I have a main form with a subform. I need to update values in the subform when a field on the main form is updated using afterupdate on that control.
Example:
main form name: mainform
control name: gst (on main form)
subform name: subform
records displayed as datasheet.
records field to update: retail
In main form gst control afterupdate event:
Me.[subform].[Form].retail_afterUpdate
Hoping to call the afterUpdate procedure on the retail field.
Error message:
Method or data member not found.
View 2 Replies
View Related
Oct 24, 2004
This may be a really simple problem but it has me stumped. Working in Access 2002, I have a form with a subform (continuous). When the user clicks on a textbox in the subform, I need to capture the value and pass it to the main form so that it can be used to create a filter for yet another subform (not nested) on the main form. How could I accomplish this? Thank you in advance!
View 3 Replies
View Related
Aug 5, 2005
Hi everyone!!
This is my first thread in this forum..Hope to get best from this site ..well i m facing a problem..i have a main form and a subform (which is in datasheet view) . Now i have a button called "close_form" in main form on whose click event i have writen this code :
Private Sub close_form_Click()
On Error Resume Next
DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70
Me.Controls.Item("fees sub").SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70
DoCmd.Close
End Sub
1. If i run this form directly from Access and there are no changes i do in the form and click this button then it gets hang after showing error "run time error 2046 ; the command or action undo is not available now " "press End or Debug or help"
2. As i have created a Custom menu, if i run this form from that menu then it does not show any error. But it runs fine for the first time but nothing happens on clicking this button the second time i open the same form ( in same session).
What to do ?? Please help ..
shikha
View 2 Replies
View Related
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
Dec 7, 2013
This is an employee timekeeping database. I have a main form "frmTEMain", with a tab subform named "frmGridsub" with a tab named "Grid" on the lower half. On the tab page is the "frmGridsub" a continuous form that looks like a datasheet, many horizontal rows of data. The subform works correctly with several combo boxes that auto populate. There are many different employees listed in the Grid subform. "Employee" is the name used for the field that holds the unique ID number in the tables that feed the subform. The subform populates another table "dbo_BCRC."
When I click on a row in the subform I want fields to update on the Main Form with Employee, LastName, FirstName, that come from the table that was populated when data was entered into the subform. As the person clicks on the various rows in the subform, the main form fields need to synch with the row.
Do I use "Got Focus" event? Do I need to create another subform and place it on the top half of the Main Form?
I can provide screen shots....
View 1 Replies
View Related
Oct 2, 2014
I have a form called CostingForm. This form has a subform called CostingSubform. The subform's data source is a table called Costing Table. The main form has a combobox that has all the "Field names" or headers from the Costing Table that populates with the on open event. I also have a non bound textbox on the main form. What I would like to be able to do is input a value in the textbox, select a field name from the combobox and with an "update" button update the corresponding fields on the subform with the value in the textbox. Is this even possible?
View 4 Replies
View Related
Jul 17, 2012
I created a main form containing list boxes and a subform. What I want to do is to select items in the list boxes. Then, by clicking "Search" button, the data filtered by the selected items will be shown in the subform. But the subform cannot work and show the query results. I think I miss some VBA codes.
Complaint Database_William.zip
View 1 Replies
View Related
Aug 21, 2013
I have a subform embedded in a main form, the subform has a field (text box) that is doing automatic calculation so no manual entries are needed from the user. I have tried to pass automatically the final result to a text box in the main form, but all events are not working (afterupdate, On change, On Dirty), etc.
I have a button to do the above mentioned in the main form, but I don’t want to use that button, I want to do all the process from the subform.
Also, from the subform I was able to do click on the button on the main form (programmatically), however MS Access is too quick and the value extracted from the subform is always empty (zero); Acees is finishing before the calculation is done.
I am using MS Access 2010.
View 4 Replies
View Related
Sep 19, 2012
I have a mainform set to data entry to add records to TABLE1. I inserted a subform that shows fields from TABLE2. I have a field in TABLE2, let's say TBL2FLD1(NUMBER). I want to add TBL1FLD2(NUMBER) from TABLE1 in the mainform to TBL2FLD1 and update said field in TABLE2.
My problem is:
(1) I get a #TYPE! error when I try to add the two fields, which I have tried many, many ways (adding them together in the Default Value; creating an unbound field to hold the calculation and then putting that field into the Default Value of TBL2FLD1; ETC), and
(2) I don't know how to get the subform to update TABLE2. It seems like the control gets stuck in the subform. Is there a way to accomplish this without coding it?
View 3 Replies
View Related
Jun 24, 2015
I have a database with a Main Menu Form, containing a Button that loads my main data entry form. When the Button is Clicked portions of the data entry form that is loading shows through the Main Form Background (e.g. portions of the navigation bars, and portions of the boarder on the form that is loading.)
View 5 Replies
View Related
Apr 17, 2015
How to update unbound textbox on main form from unbound textbox in subform afterupdate.
that is when amount paid is updated it automatically updates total paid, balance etc.
View 2 Replies
View Related
Feb 12, 2015
I have a main form and a subform.
Both forms have the field called JobID in common.
Both forms have a field called JobStatus.
Any easiest solution so that After I Update the field called JobStatus in the subform, it changes the field called JobStatus in the main form to the value which was selected from the subform?.
View 3 Replies
View Related
Aug 6, 2013
I'm developing in Access 2007 and created a runtime version.
When the user clicks the X to close the runtime application, the main form's Load event fires. Any clues as to why this might be? Some of the code is based on other forms that do close, so of course errors start flying. Note, this is only in the runtime version; the accdb file works just fine.
My current workaround is to put the offending code into the forms On Current event, which I'm able to do in this context.
Is it wrong to think that a forms On_Load event shouldn't be firing when the application is closing?
View 1 Replies
View Related
Jul 24, 2013
I have a report that tracks scores for our employees. From the report, you can click a button to add a new score in a form or edit an existing score(frmscoretracker). On this form there are two subforms, in a tabbed control to track additional information about the score; what areas were marked down(Trends), and was it a failing score(AutoFail).
When this form opens I have it programmed to only show the subform if there is data in it. The goal being, if I am adding a new score and there is no existing trends or Autofails for this new record, neither subforms will show - I will add an after update even to show either trends or autofail depending on the score recorded. Also, if someone chooses to edit the score, whatever subform with data, will show as well.
When someone clicks to add a new score, opening this main form to a new record, both of the tabs show. However, if the form opens to an existing record, the appropriate tab shows. Here is the code
Code:
Private Sub Form_Open(Cancel As Integer)
'If the subform has a record, the tab is visible, if not, the tab is not visible
If Me.frmtrends.Form.Recordset.RecordCount > 0 Or IsNull(Me.Trends) Then
Me.Trends.Visible = True
Me.TabCtl33.Visible = True
Else
Me.Trends.Visible = False
End If
[code]...
Both tabs are set as not visible in the default settings. Is there something in this code that is triggering then to be visible when there is no record in the main form?
View 4 Replies
View Related
Dec 10, 2006
Hi There,
I have 2 forms form1 (Main Form) form2 (Sub Form). Form1 acts as a header form and form2 acts like a details form. both forms are connected via code No. field. i have a combo box on form2 which on selection chooses code no and assigns corresponding values to different controls on form2. there is just one field required to be filed on form1, but i simply dont have a clue how i may go about it. for filling values on form2 i use this CODE IN AFTER UPDATE EVENT OF THE FORM :
Me.CodeNo = Me.Combo111.Column(1)
please advise me how i may update one text box on form1 from same combo box
Regards,
Darno
View 4 Replies
View Related
Oct 4, 2013
I have a form which displays information in the footer until the use has accomplished some tasks. Once I verify that all is well I allow the user to change the fields in the footer. I want to verify that the proper changes were made but the BeforeUpdate event does not fire until the form is closed.
View 3 Replies
View Related
Aug 1, 2006
Evening all,
Having a bit of a problem with a 'cattery management' database I'm working on, wonder if anyone can suggest anything pls...
From the main form "OwnersAndCats" (Main table from 'tblOwners', subform from 'tblCats') the user can either add a new cat for a current owner or a new owner, both of which are popup forms.
If the user adds a new cat to the currently selected owner, when they save and close the data entry popup form 'AddCat' I want the main form "OwnersAndCats" to be updated with the newly added cat and the form to display the owner which has just had the cat added.
If the user adds a new owner, they can either just add an owner and return to the main form or go on to add cats before returning - but either way I want the same thing to happen, ie the end result is having the main form "OwnersAndCats" displayed at the record which has just been added.
The problem I'm having is like this. The code below seems to work perfectly if I add a new cat to one of the six sample owners I imported to the table 'tblOwners' from an excel spreadsheet, but when I try it on newly created owners I get the message 'You cant go to the specified record'. Even after I get this message when trying it on one of the newly created owners I can go back to adding a cat for one of the original six and it works perfectly.
I also get the same message when I try to create a new owner then close out back to the main form. I'm sure it must be a very simple thing I'm doing wrong so if anyone can spot the mistake I'd really appreciate it! In fact if anyone can even suggest an easier way to achieve what I'm trying to do that'd also be very useful - the code's untidy I know, but I am very much a novice still - the only reason I've used the method below to show an updated form is because I'm led to believe you can't just close a popup form and simply refresh the main one behind it...
Here's the code for btnACSave on form "AddCat"
Private Sub btnACSave_Click()
Dim stDocName As String
Dim stDocName2 As String
stDocName = "OwnersAndCats"
stDocName2 = "AddCat"
On Error GoTo Err_btnACSave_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
YesNo = MsgBox("This cat has been added successfully, do you want to add another cat for this owner?", vbYesNo + vbQuestion, "Add More Cats?")
Select Case YesNo
Case vbYes
DoCmd.GoToRecord , , acNext
Case vbNo
Select Case stFormName
Case "OwnersAndCats"
DoCmd.Close acForm, stDocName2
DoCmd.Close acForm, stDocName
DoCmd.OpenForm stDocName
DoCmd.GoToRecord acDataForm, stDocName, acGoTo, stLinkOwnerID
Case Else
Call Init_Globals(Me, OwnerID)
DoCmd.Close
End Select
End Select
Exit_btnACSave_Click:
Exit Sub
Err_btnACSave_Click:
MsgBox Err.Description
Resume Exit_btnACSave_Click
End Sub
And here's the code for btnAOSave on form "AddOwner"
Private Sub btnAOSave_Click()
Dim stDocName As String
Dim stDocName2 As String
Dim stDocName3 As String
Dim stLinkCriteria As String
On Error GoTo Err_btnAOSave_Click
stDocName = "OwnersAndCats"
stDocName2 = "AddOwner"
stDocName3 = "AddCat"
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
YesNo = MsgBox("The owner has been added successfully, do you want to add a cat(s) now for this owner?", vbYesNo + vbQuestion, "Add Cats?")
Select Case YesNo
Case vbYes
Call Init_Globals(Me, OwnerID)
stLinkCriteria = "[OwnerID]=" & stLinkOwnerID
DoCmd.OpenForm stDocName3, , , stLinkCriteria
Case vbNo
YesNo = MsgBox("Do you want to add another owner?", vbYesNo + vbQuestion, "Add More Owners?")
Select Case YesNo
Case vbYes
DoCmd.GoToRecord , , acNext
Case vbNo
Select Case stFormName
Case "OwnersAndCats", "AddCat"
DoCmd.Close acForm, stDocName2
DoCmd.Close acForm, stDocName
DoCmd.OpenForm stDocName
DoCmd.GoToRecord acDataForm, stDocName, acGoTo, stLinkOwnerID
Case Else
DoCmd.Close
End Select
End Select
End Select
Exit_btnAOSave_Click:
Exit Sub
Err_btnAOSave_Click:
MsgBox Err.Description
Resume Exit_btnAOSave_Click
End Sub
And finally my global variables:
Option Compare Database
Global stLinkOwnerID As Integer
Global stFormName As String
Option Explicit
Public Sub Init_Globals(rfrm As Form, OwnerID As Integer)
stLinkOwnerID = rfrm.OwnerID
stFormName = rfrm.Name
End Sub
Many thanks for taking the time to help!
View 4 Replies
View Related
Dec 20, 2011
I'm working on a project that has two tables. "Calls" and "Customers". The Customers form has a subform, "Calls Subform" in it. When you click on the (New) Hyperlink a new form opens, "Call Details". I would like to pull information off of the "Customers" Form and insert it into the newly opened "Call Details" form.
Problem #1) Home Phone (named "Phone" and Text223 (named "CID"): are both bound controls so I have to do this in an OpenArgs type process.
Further details:
On "Customers" the following is true:
"25" is the "ID" for that customer on the "customers" table
"Home Phone" is the home phone number on the "Customers" table
On Call Details the following is true:
Home Phone is Bound to a table "Calls" and needs to pull it's data from Customers Form..Text223 is CID and bound to the table "Calls" and needs to pull it's data from "Customers" form.
View 14 Replies
View Related
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 1 Replies
View Related
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
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
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
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
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
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