Use Popup Form To Select A Record On The Main Form
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 Replies
ADVERTISEMENT
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
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
Jan 23, 2015
I have a 'main' table with a Project_Number that links all the data in my db together. I have another table that uses that Project_Number as a lookup field to connect that tables data to the main data. I created a 'main' form that has the ability to enter data for the 'main' table. I want to be able to press a button and have the second tables form pop up and add that that specific Project_Number. I added the button and went through the wizard process. I then added the linking info through the builder. It works fine if there is already data entered for the project_number in that specific field. but if the field is empty, the popup window doesn't recognize a project_number and doesn't add it to that record. below is what I am using. The project_number in the 'main' table is text and the Project_Number in the 2nd table in a number since it is a lookup field.
Private Sub CongressionalDistrictCmd_Click()
On Error GoTo Err_CongressionalDistrictCmd_Click
Dim stDocName As String
[Code]....
View 9 Replies
View Related
Jan 23, 2006
I have set certain fields on my main form to be required to protect from accidnetal skipping which has occured in past. However, in middle of form, there are a group of checkboxes, which opens their correndsponding popup forms for more details. Right now, I get an error if it try to pop up a form because not all required fields are filled in.How do I make Access suspend the requirments whenever the checkboxes are checked and additional info are being inputed?Edit= tried setting it as dialog boxes, but to no avail.
View 9 Replies
View Related
Jul 3, 2005
Hi All,
I have a form that has a combo box and a subform. After a choose the value of the combo box I want to start adding values into the subform, and I want to be able to select the values that are to go into the subform fields. Now I am thinking of using a pop-up subform which shows the values that I can choose from and then as I close the form it will populate the fields of the main subform.
Is it possible and has anyone got a little example of form that can do that. If so can you put it as an attachment to this post.
Thanks
Greg
View 1 Replies
View Related
Sep 13, 2013
I have a table with about 3800 records and about 150 fields. It also has 4 tables with related data that each have only one field. I am going to create a query to base my from from. Should I just take the star * and get all the fields for each table or should i manually specify them. There are only about 5 fields out of the 150 that I dont need and I need to see the rest.
View 13 Replies
View Related
Oct 25, 2013
I'm working on a database that has a subform which pulls its data from a table and I'm trying to use a popup form to enter the data in the sub form. For example the table is called student debts. The form is called student debt. The pop up form is called student debt entry from. I want the inform that's in the student debt entry form to be recorded in the student debt form which is a subform on the main form. I know i have to create a add new records button to do it but not sure of the code.
View 4 Replies
View Related
Sep 7, 2005
Hello,
I am trying to run a macro on doubleclick in a subform (dataview) that will open the same record in a popup form (tabular).
I've enter in the macro Where Condition the following statement to only show the record I doubleclicked on in the popup. The only problem is it's asking me for a parameter value for the LogID. Its apparently not picking up the LogID I doubleclicked on. Is there any way I can fine-tune this WHere statement so that it knows the record LogID I clicked on. (The pop up form should show only the same record).
[LogID]=[Forms]![CommunicationLog Subform]![LogID]
View 1 Replies
View Related
Jun 15, 2014
I have a popup called by a subform to add a new record or edit a selected record. I keep getting "Runtime error 32502". The value you entered isn't valid for the field "|"
I have no required fields and all the drop down related fields have the right value type in them (That I can find)The only "|" reference I can find is in the OpenArgs content below when I load the form. If I'm adding a new record I pass two fileds via the OpenArgs
Private Sub Command52_Click()
DoCmd.OpenForm "AddDebtorPaymentFrm", , , , acFormAdd, OpenArgs:=Me![DebtorId] & "|" & Me![MatterId]
End Sub
or if I'm modifying a record from the subform on click I
Private Sub Text38_Click()
DoCmd.OpenForm "AddDebtorPaymentFrm", acNormal, , "[Transactions].[TransId] = " & Me.TransId, acFormEdit
End Sub
Below is the Popup Load code
Private Sub Form_Load()
If Me.DataEntry = True Then
Me.VariableHeading = "Add A Debtor Payment"
[code]....
View 8 Replies
View Related
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 1 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
Aug 19, 2014
I have a bound form which is from tblEmployee, I'd like to have a dataset below (like a splitform but not a split as they have limits) so when i search in the box it gives me say all the smiths - i select for example david smith and it displays his information in the form objects above so they can be edited?
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