Refresh Main Form After Inserting New Record In Another Form
Jan 24, 2012
I have a main form where information for a particular part number or job is entered. Should the part number not yet exist, Access will let you know. I have a button within the main form that opens up the Form_EnterPartNumber form which allows you to enter the new part number.
What I would hope to be able to do would be to refresh (requery?) the main form after creating a new part number and closing the Form_EnterPartNumber form..........but, keep the main form on the current record instead of resetting back to record number 1.
Is this possible?
View Replies
ADVERTISEMENT
Mar 26, 2005
I have a form which contains one subform. On the subform I have a command button which saves the record just entered. On the main form I have a "refresh form data" button which updates the main form so that the calculated controls can show the correct results based on the data just entered?
Can anyone tell me how I can get the "save record" button in the subform to subsequently refresh the data in the main form as well, thus saving a button???
Many thanks.
Peter
View 8 Replies
View Related
May 11, 2005
Hi
I have a sub form and a button on the main form that needs to be pressed to refresh the data in the main form after data has been entered into the sub form.
Is it possible to have the main form refresh on exit from the sub form field automatically without having to press the button??
Could i hide the button and run a bit of code that runs the refresh button on the main form on exit from the subform field?
thanks in advance
View 12 Replies
View Related
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
May 14, 2005
I really hope I can explain this right :o
When a customer makes a purchase I INSERT the transaction into the 'transactions' table, which I have no problems with. My problem stems from that I can't seem to get the 'OrderNumber' back from the 'transaction' table (OrderNumber is an AutoNumber by the way).
I have tried the following code -
TempOrder = DLookup("OrderNumber", "transactions", "customerID = '" & Forms![frmOrder]!TempID & "'")
"Forms![frmOrder]!TempID" is the value I use from another form (to see who the customer is). I want "TempOrder" to be the OrderNumber that is created in the transactions table.
Regards, James
View 6 Replies
View Related
Sep 2, 2006
I'm not sure how to search on this, even in the advanced search. If this has been answered, could you point me in the right direction?
I have a main form AddNewCompany (the infamous tab control that now works - thanks to your combined efforts). On it I have a command button that pops up a form of continuous forms with all the companies in the table (the query calls the CompanyID and CompanyName fields only). I have attached an image of the interface.
This means the user can see if the company already exists and doesn't enter it again. (I'm sure there are more effecient ways of doing this, but this is simple and it works. I also know key fields should be autonumbers instead of text, but I have reasons for doing it this way).
What I would like to be able to do is click on the CompanyID field and have the companies information show up in the main form.
View 14 Replies
View Related
Sep 4, 2006
Can anyone see what I am doing wrong?
I have a main form that has a tab control on it. The main form is called frm_AddNewCompanyContacts. It is opened in edit mode. To see if a company exists I use a command button to call a popup form with a list of all companies' IDs and names. I then want the user to be able to click on a commad button on the popup form to take the main form to that record. After an intial post, and subsequent search, I found the appropriate code. This is what I am using for the onclick event of the command button on the popup form:
Private Sub cmdGoToCompany_Click()
Dim rst As Recordset
Set rst = Forms![frm_AddNewCompanyContacts].RecordsetClone
rst.FindFirst "[CompanyID]='" & Me![CompanyID] & "'"
If rst.NoMatch = False Then
Forms![frm_AddNewCompanyContacts].Bookmark = rst.Bookmark
End If
End Sub
When I click on the command button I get an error message:
"The expression On Click you entered as the even property setting produced the following error: A problem occurred while Microsoft Office Access was communication with OLE server or ActiveX Control (I don't have an ActiveX Control).
*The expression may not result in the name of a macro, the name of a user-defined function, or [Even Procedure].
*There may have ben an error evaluating the function, event or macro."
View 10 Replies
View Related
Jul 2, 2014
The problem I have is, that I need to insert an apointment into de database but first I need to verify if there is a record or an apointment in that room that day the same hour, if that is so send a msgbox saying an apointment already exist in that room this day at this hour.
i tried using dlookup but it only works in one record using just one criteria
View 10 Replies
View Related
Dec 14, 2014
I have a form for entry and some fields are computed or result of a query from another table. I have a function that looks up a value from another table like so
************************************************** ********
Public Function GetTargetType() As Variant
GetTargetType = DLookup("type", "tblFormulations", "[tblFormulations!formulation]=Forms![frmNmsConsumptionEntry]![formulation]")
End Function
************************************************** ********
Which works fine when I test in the immediate window.Then I have this form event. This however does not insert this value when I am adding records using my continuous form.
************************************************** ********
Private Sub Form_BeforeInsert(Cancel As Integer)
Me!target_group = GetTargetType()
'Forms!frmNmsConsumptionEntry!target_group = GetTargetType()
'[tblNmsConsumption.target_group] = GetTargetType()
End Sub
************************************************** ********
making sure I can insert this value once retrieved.
View 7 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
Sep 3, 2014
I have been trying to figure out how to make a form refresh after deleting a record in a subform. The code in the combo box that populates the subform works fine. If you select the "Action" of "sign" from the unbound combo box above the subform, it places "Sign" in the the subform and then makes a checkbox on the main form [WillTake] = True.
But when I delete the record by right clicking on the entry, the focus is sent back to the main form so I can refresh the form and thus update the [WillTake] checkbox. I have tried just about everything. I can get the focus to a field on the form, but I cannot figure out how to refresh or requery the form.
The code to transfer focus is on the OnDelete of the subform.
I have included a watered down version of the DB.
View 11 Replies
View Related
Dec 10, 2013
I have two subforms on a "Page"/Tabs. Subform #1 is a continuous form which accepts data about dimensions of a pattern piece. The other subform needs to update its information display each time the last control of the first subform loses focus, because it tells me how much material is required for all pieces of this pattern that are entered.
My first feeble attempt at this was to add the following code to the "Lost Focus" event of the final control on the first subform:
Form.Parent.Refresh
This succeeded in forcing the second subform to re-run its calculation.
However, after the recalculation took place, I wasn't able to move to the next record on the first subform. This subform is a continuous form, and I need to be able to add another row of data and then see the second subform change based on the additional information in the first subform.
Obviously I've done this wrong.
View 1 Replies
View Related
Mar 24, 2015
When I add a record in the subform and then move to the next record whilst still in the subform, the main form jumps back to its first record? I then have to move back to the right record in the main form to update the next record in the subform.
I want to move to the next record in the subform without affecting the main form.
View 1 Replies
View Related
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
Dec 16, 2014
I am creating an events database. In my main form, I have all the details of a single event (billing code, fees, customer, support personnel, etc.). Then, I have a subform (form view) that lists each of the other services which share an event ID (this ID comes from a separate, unrelated events management suite). In the subform, I display the most-commonly-edited fields so that they are editable without navigating to a different record.
However, there will be instances where it becomes necessary to navigate to one of the records listed in the subform. I would like to make this a quick process by just clicking on the primary key in the subform, and have the corresponding record appear in the main form.
In my searches I've found a common suggestion to use a DoCmd.OpenForm method where the form opens to that specific record -- in effect filtering by the primary key number. I don't prefer this method because it disables the ability to navigate to other records using the previous, next, find records, (etc.) buttons without closing and re-opening the form.
Is there a way to make the main form 'jump' to a specific record by clicking on a control in the subform, without limiting the ability to navigate in the main form?
View 10 Replies
View Related
Jun 5, 2006
Hi
I'm trying to create a record in a sub form from the main form, but just cannot get it to work!
any ideas how I do this?
thanks
H
View 10 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
Aug 4, 2005
Hi,
I want a user to be able to create a new record in the main form, after they have finished filling in the boxes in a subform by pressing the Enter key, rather than having to click the 'new record' button on the main form.
I reckon I need a 'default button' on the subform but I have no idea what this should do when clicked to create the new record...
View 1 Replies
View Related
Sep 12, 2006
Hello,
I have tried everywhere for a solution to this:mad: Any help is much appreciated.
I have a main form with a subform. The subform shows related records using a match criteria. Each record that shows in the subform also has a unique ID. This unique ID is also shown on the main form record (although not used to link the main and sub forms).
I would like to be able to click on a command button on each of the records in the subform and goto the Main form record. I can't find any threads that deal with this though - sorry!
Hope it makes sense
DJ
View 1 Replies
View Related
Aug 26, 2004
I have a subform that is populated with records, filtered by two combo boxes on the main form. I would like to be able to double-click on one of the records in the subform and have it populated in the main form for editing.
Any help would be greatly appreciated.
Best regards,
MrAviator
View 5 Replies
View Related
Aug 10, 2013
I have a form and a subform for data entry.It is often the case that not all the data may have been entered and so a user might need to go to recordID 24 in 30 already entered main records.However, he needs to get to that record via a (unique) 1-1 field. How do I create the form so that as well as being able to go to the first, the last, the next, the previous record, I can go to a record of my choice.
View 5 Replies
View Related
Jul 16, 2013
I have two forms, the first of which I'll refer to as my "main" form. The main form has 6 text boxes bound to Table1.
There is a one-to-many relationship between the records of Table1 and the Dates table.
After filling out the first 2 text boxes of the main form, I want to open up a second form to populate the Dates table. I'm using OpenArgs to pass through the PK of Table1, so that it can be recorded in the Dates table.
Sometimes I'll want to enter a 2nd or 3rd date, but I am getting an error message after entering the 1st date. It says that Access cannot find a matching key in the main table.
Is there a way for me to save the record in the Table1 prior to opening. The second form so that I can avoid the error message?
I don't want to use a subform to enter the dates because I don't care for the datatable look of subforms. After entering the dates in the second form, I then want to go back to the main form to complete entering the remaining text boxes.
View 7 Replies
View Related
Jul 19, 2005
Hello,
I am trying to create a command button that clears all the records in the Sub form in the CURRENT RECORD OF THE MAIN FORM.
I know this sounds a little bit confusing, but I hope you understand!
The main form is: frmOrder2
The subform is: subfrmItemOrder
The fields in the subfrm that has to be cleared are:
Items (combobox)
UnitID (combobox)
K1 (txtbox)
K2 (txtbox)
K3 (txtbox)
CSB (txtbox)
DTSS (txtbox)
H (txtbox)
Remarks (txtbox)
The two forms are linked by the field OrderID.
Please help me!!
Thanks!
jenny
View 14 Replies
View Related
Nov 20, 2014
I am currently working on a project in access 2010 and I am having a search for record dilemma. I have a main form that has a subform in it under a tab control. I place a search box at the top of the form so that user could select either the ID, the internal case number, and/or the reviewer name in the text boxes to search the record.
I have tried the using the search for record macros and the convert the macros to VBA and possibly write so extra coding for calling the subform into the search but nothing seems to work in getting the search in sync between the main form an the subform. VBA code that will look for same record in both forms.
The reason for the tab control is because depending on the data entered the users switch between mid section data about case and so one set of info goes into one tbl and the other goes into another, but the subform that I am referring to in this question is being generated from the same tbl as the main form.
View 2 Replies
View Related
Dec 24, 2013
I have two unbound subforms on an unbound "display form". I managed to link the two subforms by following this method: [URL] This is great and works well enough, however, by design, subform2 will only display records relevant to the very first record on subform1. I need subform2 to be filtered based on ALL of the relevant records being displayed in subform1 not just the first one.
Previously, subform2 was based on a query using subform1's records as criteria, but this gave me the same result.
View 14 Replies
View Related
Aug 20, 2007
Hello everyone,
I have a query that runs from the main form when the command button is clicked. It displays the results in datasheet view. I want the user to double click a specific record and jump to that specific record in the main form. How do I do this? Sorry, if this is a dumb question. Please help, my boss is breathing down my neck. :eek: The main form is called Contracts. Each record has a unique ID.
Thanks,
Jason
View 11 Replies
View Related