I have a multi select list box which I am trying to use to open another form and apply a filter based on the user's multiple selections.
List box - lstCatergories Main Form - frmSuppliersSummaryCategories Subform on Main Form - frmSuppliersSummaryCategoriesSubForm
The Subform contains the text box CategoryID
Here's my code which nearly works...
Code: Private Sub cmdFilterSuppliers_Click() On Error GoTo Err_cmdFilterSuppliers_Click
Dim strWhere As String Dim ctl As Control Dim varItem As Variant
[Code] .....
My problem is that the control "CategoryID" is on the subform and I'm having massive problems trying to reference it. This is the part of my code that won't work:
I'm trying to check if a control on the subform is null. I've the following line of code:
Private Sub Form_BeforeUpdate(Cancel As Integer) If IsNull(Form!FrmOrderInfoMain!SubFrmOrderInfo.ItemC ode) Then Msgbox "Empty ItemCode" End If End Sub
..whereby FrmOrderInfoMain is the parent form and SubFrmOrderInfo is the subform. I get an error for this code as Im not sure what is the correct code to use. Thanks for the help.
I've been trying : double click a field in a subform and paste the query results into excel. I already have good code to paste in the recordset, but this recordset must reference a control value in a subform.
The query works and shows the proper results manually, but when I run the Sub it throws a "run-time error 3061: Too few parameter. Expected 1."
I can't seem to set the parameters right. Tried EVERYTHING--except the RIGHT thing.
frm_process_ppl (single form) which has the datasource as qry_process_ppl_2 on this form is a subform (continuous) frm_process_ppl_orig
with the same data source linked by [ALINK].I want to run an append query when I click on one of the controls of the subform.On the subform there is a uniqueID called [LNK]
In the append query I have the following criteria for the LNK field [Forms]![frm_process_ppl]![frm_process_ppl2].[LNK]..However it is not working.I think my criteria is wrong.
(This worked fine with just one form but I have had to add an additional subform and the original form was continuous. I cannot add a subform to a continuous form so I decided to creat a single form to house the continuous form) I just cant reference what Im clicking in my query !!
I have a form and subform with the following names:
frmBasic sfrmCustomers
I have a unbound txt field called txtCustName on the mainform I want to populate this field from a field on the subform called CustName when the record is selected.
I also have an unbound combo box with the cust ids using the row source from the tables record source from the main form.
Me.txtCustName = Forms.frmBasic.sfrmCustomers.Form.CustName End Sub
This didn't work. So I put "= [Forms].[frmBasic].[sfrmCustomers].Form.[CustName]" in the control source of the text box on the main form I want populated.
The name doesn't appear in the field. I get #Name? in the field.
When I run the following code in a module -- to change the value of a label in a subform ("Employees Trained List subform" is a subform of "Contractors") I get an error that says it can't find the form (ie. Contractors). Also, if I eliminate "[Contractors]" the error says it can't find "Employees Trained List subform": Forms![Contractors]![Employees Trained List subform].Form!lblThisYearTrainedDate.Caption = Year(Now()) + 1 & " Trained" Any ideas on how to fix? Thanks
This code checks to see if the last three characters on a ControlSource.Tag property are "Req" and if they are, tests if it's null or = 0 and if it is then it outputs a msg box stating that the control.ControlSource is required. It does it for every control on the main form.
This has worked.
Now, i need to allow for multiple subforms to be located on the main form along with their controls being tested as well. I want to start another loop for each time the conrol on the mainform is a subform.
I have that done so far by using "If TypeOf ctl Is SubForm Then..."
This is the part i need help with. I want to search all of the controls on the subform when it is a subform. I need to search all of the controls on the subform then, and i'm not quite sure of the syntax.
I've tried various somethings like SUBFORMCONTROL.Controls but that hasn't seemed to work...
If someone could help me, that would be wonderful!
Newbie question: I have a datasheet view subform (called "UpdateProjectsSubform") in an "empty" form. I set it up this way because I was unable to get the Switchboard to open the subform in datasheet view.
I would like to have a command button to set filters in the subform. As I cannot have a button in datasheet view, I think my best option is to place a button on the master form that performs the command on the subform. I have tried every which way, but can't seem to get the correct syntax to reference the subform. I have searched this forum as well as other references with no success. Any ideas?
I am trying to add a save/close button to a form that will only close if certain conditions are met and if they arnt then display a message box.I got the basics on how to save and close the form, do a simple if statement and display the message I want but the problem im running into is my subform can have multiple records and of those records each records status is set by 3 different checkboxes. I need all of those records status to be same when the form is closed.
if I do an if statement like
If Me!frmDataform1subform.Form!StatusID.Value = 1 then docmd....
then all it looks at is the first record, how do I get my if statement to look at all the records in the subform?
I have a main form (frm_main) in which I have a subform as a datasheet (frm_sub1).In the first sub form I have a second (nested) subform (frm_sub_sub2) as a datasheet as well.
On the main form I have an unbound text box which gives me the value of the ID field in the nested subform (frm_sub_sub2).In the main this works well, however, I hit a problem at a particular point.
If I expand an entry in the first subform (frm_sub1), then, in the main form (frm_main) I get the first ID value from the corresponding records in the nested subform (frm_sub_sub2) as expected, which then changes as I scroll through the expended records.
However, if I then expand another entry in the first subform (frm_sub1) without collapsing the previous entry, the ID value shown on the main form (frm_main) from the nested subform (frm_sub_sub2) remains the same and doesn't change to the currently selected record. Even if I then collapse the first selected entry on frm_sub_sub2 - the original ID value still remains on the main form (frm_main).
i'm working in access 97 and am having difficulties pulling a subtotal or referencing any fields on my subform on my main form. I've searched the forum and help and tried to apply the info provided, but i still can't seem to get it to work.
as far as i can tell this should work:
=[MySubForm].[Form]![TxtTotalStaffNumbers] but i'm still getting the dreaded #Name? error.
anyone got any clues as to what i'm doing wrong?
what about the case where the subtotal i'm referencing is a calculation such as =Sum([Quantity]*[FacilityArea]). Should i still be able to reference it on my main form by pointing to the name of the field?
I have a Main form with several sub forms on it the tables behind each form are related tables. The user enters data on the main form with the exception of one bound control then moves on to enter data on the sub forms On exiting the record or the main form I want to take data from several of the sub forms and add them together and enter result in the bound form on the main form. Because this bound control is not used to enter data in there are no event triggers to code to get this done.
Eventhough i know calculated control are for queries, I still need to store a calculated value of a sum. I have a form with customers, dates, locations. That form has a subform that contains the services done and materials used. This subform is in datasheet view. In the footer i have a control with =Sum([Price]).
So I need the value of this control to be stored in the table the main form is based on. I did an unbound control in the main form where the =Me!Subform.Form!.Textx will bring the value "over" Then for the on focus event the vba code Me.Total=Me.Textx stores the value. That is fine. The same works with a command button with the same vba code.
However i am asking if there is a more automatic way to get the value over without the unbound control/command button.
I have a form - purchase, and a subform purchase detail they are linked with a field "puid"..I need the dmax to give me the maximum auto number field "pdid" on the subform in a textbox on the mainform.
I have a listbox on a subform (or a subform within a subform).
When it is clicked I want all other listboxes to unselect.
There may be listboxes on the mainform, on other subforms, on other subforms of subforms.
I imagine I'm looking at a recursive function of some sort, but I'm not entirely sure of syntax to identify parent and children forms...
pseudocode so far: loop all controls if control = listbox, unselect all if control = subform - recurse: loop all subform controls if control = parent... err... Fail.
I am trying to limit the number of records displaying in a subform [amendedLoans] by selecting only those records that have the same ClientID as the mainform [Customers] and the same loan number as the subforms parent form [ClientAccounts loan changes].[loanno].
I have no difficulty selecting records just using the clientid but as soon as I add the reference to the subform [loanno] field I get no selection of records. I suspect there is an error in the where clause for [Amended Loans].Loan)=[Forms]![customers]![ClientAccounts loan changes].[Form]![LoanNo]) .
I have built the clause using the expression builder and have had many attempts all ending up with the same result. I'm now at a loss as to where to go from here....
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.
I need to have a subform that shows up smack dab in the middle of my main screen when visible - which is what I want - but only based on a specific value of a control on the main form. Specifically, if a control's value is "See Spreadsheet", I want the subform visible front and center as it contains the link to the server location for that specific record. If the control's value is not "See Spreadsheet", I want the form to be invisible.
My code:
If Me.BudgetsFacultyAccountNumber = "SEE SPREADSHEET" Then Me.frmMsgBoxUpdateSpreadsheet.Form.Visible = True Me.BudgetsFacultyServerLocation.Visible = True Else: Me.frmMsgBoxUpdateSpreadsheet.Form.Visible = False Me.BudgetsFacultyServerLocation.Visible = False End If
The red lines result in an MS VBA error: "Compile error: Method or data member not found."
I've tried referencing that subform a hundred different ways, but I can't get it to work.
I am trying to filter a subform on a tab control based on an input on a second form.
Mainform: frm Index Page 2 Tab Control on Mainform: tabctrlMain Subform: Customer Details Tab Name: tabCustomerDetails
The second form is basically a separate Search Form where users can look for a customer ID and returns the ID back to Customer Details form.So far I have managed to redirect focus to the correct tab on the tab control using the following code:
DoCmd.OpenForm "frm Index Page 2" With Forms("frm Index Page 2") !tabctrlMain.Value = !tabCustomerDetails.PageIndex End With
However, I am stuck with the filtering part. Everything was working fine before I began putting the forms together into one big tab control (I tried using Navigation Pane but there were too many referencing problems so I gave up on that one).