I have a form displaying the contents of a table in a datasheet view. I want to click on a row and open up a new form that will use a field in the selected row as a parameter.
I know how to call the VBA procedure by setting the double click on field (Cant do it for click on any fields in the row?) and in the VBA was using:
strText = Me.[Product Reference].Value
to get the required value. However this only seems to work in single form view. If it is in datasheet view it gives an error and will not let you save the form.
I am guessing I am missing the row identifier in my VBA code.
Not sure which forum this was under, but I figure Access might be it
I have a stored procedure already written which works fine, if I supply the criteria to it before or at manual execution. I want it to use a field on a form in an Access Data Project as it's criteria (as a form is built off the results of the procedure). I can't find any documentation on how to pass criteria to a stored procedure for use in SELECT WHERE statements.
Can somebody point me in the right direction? Here is my stored procedure:
When i execute this manually I get the dialog prompt to enter the value for @parHomePhone, which is what I want to automatically pull from txtPhone on the frmSearch form.
The procedure call "Call RearrangeCoordinates(RearrangeCoords(), ReturnCoords())" return a message "Type mismatched: Array or user-defined type expected"Are there any views as to why the message is being displayed?
Private Sub CommandButton1_Click() Dim ReturnCoords As Variant Dim ........................................... ArrayLength = UBound(ReturnCoords)
On my form I have a combo box where the user can select the sex of a person. I had set the row source of the combo to a table, tblSex and this works fine. Now I want to programatically add the table entries ( simply male or female) to the row source, having set the combobox to value list. I cant see how to pass the combobox and tablename parameters and I am getting an error on form load "The expression you entered as the event property setting produced the following error: UserDefined type not defined" The calling procedure from frmPeople is
I think the way the parameters combobox and tablename are passed is incorrect. I want to write a robust procedure which I can use for each of the comboboxes on my form.
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:
I have a sub form which has the Save Button. In case the user keys in the details in the sub form, but then directly clicks the Payment command button of the main form, I want to call the Save button in the sub form if the form is dirty, and do the save, otherwise, proceed with the payment command button.
Every time I try to call the save procedure from the main form's Payment button, I get this error that "object does not support this property or method"
I am calling the save button's code in the subform as
forms.MainForm.SubForm.Save Producedure
Exact Code is : Forms.newpatients.InvoiceHeader.Command7_Click
How do I call this command7_click, which resides in the sub form, in the main form, and invoke it only if the data in the sub form has changed.
I got a little problem wich i'm trying to solve for several days now. My situation is like this. I got a form called "Frm_File_List" and in there a subform "Frm_List_Sub" as in a datasheet. In here there are several records. Im trying that when u double click on the record that a new form "Frm_View_file" will be opened, but according the record I selected in the subform. So when I doubleclick on ID 7 it opens the form with record matching ID 7.
I tried in vba the following
Private Sub Form_Click() DoCmd.OpenForm "Frm_View_File", , , "Files_ID = Forms!Frm_List_File!Frm_List_Sub.Form!Txt_Files_ID " End Sub
But when I double click on the record it gives me this popup screen asking for the ID. When I fill in this manually then it does give me the wanted record in the form. But how do I get his ID passed automaticly?
I am in no way shape or form familiar with access beyond the very basics. I am however the house programmer and some of the employees here like to create access forms (no programming knowledge though). So from time to time I am asked to help out with the more difficult tasks.
The issue I have run into is that we built a form(that has no connection to a table or query) that has a subform on it (that is connected to a table). Basically the subform information is used to help fill out the form which is then printed.
Problem is that when the form is printed all of the records of the subform are also printed. I am struggling with finding a solution.
Is there a way to just have the subform print the current record shown?
I tried having the form grab the current record from the subform to print the info out on the main form but I can't seem to get the two to talk. How do I use subform info on the form? I have tried something like Me.mysubform.control.text or [Forms]![Me]![mysubform].whatever but nothing seems to work.
One work around I am currently trying to implement is to have the subform visibility set to false which allows me to just print the main form. Problem is that I need the info off the subform also. I try to say something like myformlabel.caption = mysubformtextbox.text but nothing seems to work.
Any help or direction would be greatly appreciated.
Hi--I am working on a database which is a modification of the following MS Access 2003 Order Management template: (URL address blocked: See forum rules)=CT101426031033
In my database, I have a subform called sbfOrderDetails, which in its Form Footer has a text box that sums the items in the order and is called OrderDetailsTotal.
I am trying to pass that value to a text box in the main form called OrderSubtotal.
I have three questions:
1) What is the proper syntax to use to get the value of the subform control into the OrderSubtotal control on the main form? I have tried various permutations and continue to get a #Name? error.
2) If you look at the expression in the Order Subtotal control of the Add and Manage Orders form in the original Order Management template, it looks like this:
=[Order Details Subform].Form!OrderDetailsTotal
When I try to replicate that in my database, I cannot--if I add brackets around my subform name and press Enter, Access adds brackets around everything in the expression, i.e. =[sbfOrderDetails].[Form]![OrderDetailsTotal] (which returns a #Name? error). If I edit out the brackets I don't want and then press Enter, it puts the brackets back in. In other words, Access keeps trying to "fix" my expression by either having brackets around each item, or no brackets at all! This is really annoying; is there any way to turn it off??
3) When sbfOrderDetails is set to Single Form view, I can see the Form Footer (and the value in the OrderDetailsTotal text box as well). When it is set to Datasheet view, I cannot. Why?
Thank you very much, lcnlit
PS>I cannot attach my database since I am a new poster, and the forum is disabling the URL of the Microsoft template as well.
I have a stored procedure created in SQL SERVER 2008r2
I have a form in access adp project with combo boxes, when I click the submit button I want the values chosen to be the parameters and the stored procedure called to generate a report
I know this has got to be a simple reference problem, but I just can't figure it out. I am trying to pass a nested subform to a procedure, but I keep getting a type mismatch error. Here's an example:
I know how to use openargs to pass values between forms but im not sure how to go about passing all the values from one subform to another.
To be specific I have an order form (frmCustomerOrders) that has fields like CustomerName, EmployeeName, OrderDate and so forth, the subform (frmCustomerOrdersSubform) contains information on the Products the customer is ordering which usually has multiple records with fields like ProductName, PartNumber, Quantity and ItemNumber. I want to pass the values from the CustomerOrdersSubform form to another subform (TransferSubform) My initial thought was to use something like the openform command through openargs but im not sure if that will work or if there is another method I should use.
I have a form, Salesperson, that has a subform Salesperson_SalesGraph. The SalesGraph subform is a pivot chart.
I'm having problems with trying to access items on the subform. The weirdest part is that it seems to work if i call the event from form_open, but doesn't work if i move the code to form_current. This won't work for me, as i need the function called whenever i change rows.
The error received is: You entered an expression that has an invalid reference to the property Form/Report.
First I had the code on the main form, accessing the chart object on the subform but was getting errors that i couldn't access the form property in the assignment, Set objChartSpace = Me.salesperson_salesgraph.Form.ChartSpace (i tried a number of differnet ways, with !'s, with Forms("SalesPerson_SalesGraph), etc.
Then i moved the code to the subform and now i'm just trying to call the publically declared sub with the line:
Forms!Salesperson!Salesperson_SalesGraph.UpdateLeg end or Me.Salesperson_SalesGraph.Form.UpdateLegend
The subform has a sub declared as: Public Sub UpdateLegend()
I have just made a change to one of the forms by adding a button (by copying the only other button on the form) to cancel any changes and close the form. However, as soon as I added it I started getting the error message in the title. Please attachment LA Err1 for the full message. I also changed the caption on the other button on the form from "Close Form" to "Save && Close Form" this button is now giving the same error.
I have Compacted and repaired the DB on several occasions to no avail. I have deleted the procedures from the module and recreated them using the properties window - still get the error. I have deleted the buttons from the form and recreated the both via the object wizard and without it. Nothing I have tried has made any effect.
I have a form called chartinfo which contains a subform called testgroup. For ever new record in the main chartinfo form I need the testgroup subform to display all records from the testgroup table. see attachment it is access 02
I would like to transmit several parameters from my main form to the subform when I open it.
Parameters could be used in the subform by onload event, for eample, to define form caption, hide or show buttons, enable or disable edit boxes, give them a color, ... It could also allow to use the same form in different application contexts, which would reduce so the development time.
More than one technique might be possible. I used the following one : - I put the parameter value I want to pass into myParameter - when click on the button to open the subform : DoCmd.OpenForm myDocument, acNormal, , , , , myParameter - when loading the subform, retreive the parameter value in Me.OpenArgs and using it (eg disable a button)
It works fine. But I can pass only a single value with this technique and it's not enough. I tried to give an array as myParameter and fill it with my parameters values, but Access refuses an array to be in the DoCmd statement for OpenArgs option.
Any idea about passing several parameters to the subform ? Or may be an alternative to the DoCmd technique ?
I have encountered several times, and now, that after using any "cut and paste" or "copy and paste" on VBA code in the event sub, even for a few words, Access does not allow me to exit when I answer 'Yes' to save the changes. It forces me to respond "No" to exit and re-enter any changes again without using copy or cut and paste.
This is very troublesome and error-prone in program development that the program statements cannot be moved or copies to another location of the program module.
I have over 30 TextBoxes and ComboBoxes on the form and about 20 pages of program code, using Access 2010 (same situation for Access 2013) on Windows7 PC with 4GB of RAM.
I will have a ListBox on the form with “Multi Select” set to either simple or extended. I have a collection of documents which must be recorded in a database. Some documents may have only one author, but could have more. Same with the recipient or copied-to.
Ideally it would be nice to have the ListBox on the left, selected one or more from the list and then pass them to one of the three fields by a command button, sort of like:
I would like to have all of the names selected from the ListBox as a string, but fully understand the problems associated with normalization. Other posts have suggested subforms. So, the question is how to select from the ListBox and then pass the possible multiple selections to discrete fields on a subform that would display, say three fields and which would get away from the normalization issues:
The secondary issue will be that there will be subsequent names which are not found until actually in the process of document review which will create a need to update the ListBox, which I know is not akin to a ComboBox NotInList function.
If there are any thoughts or coding out there which will help, it’d be appreciated. Lawguy
I have a form that has several sub forms and what I want is that if the user chooses Plan Name in the main form "No Fault" or 'Workers Comp". I want message to pop and go to the field in the subform to enter data but I keep on getting an error.
Private Sub Plan_Name_AfterUpdate() If ([Plan Name] = "No Fault") Then MsgBox "Enter additional information in No Fault form before continuing." DoCmd.GoToControl ([NoFaultWCompsubForm]![Attorney Name]) End If End Sub
It says the action or method requires a control name argument?
I have a button on a subform that becomes visible if there is no records in the source of the subform. When clicked I want to run a query that will insert a record on to the source of the subform. There is one field in the query that I need to get from the parent form.The first part works OK - the button is visible when the source file to the subform for this main form record, is empty.
If I run the query against the source file it inserts the new record after it has asked for the value of the variable field.My problem is that when I try to run the query when the button is clicked It can't find form![ClientFileFrm]![ClientId]..This is my code on the subform
Private Sub Form_Load() If Me.RecordSource <> "" Then If Me.Recordset.RecordCount = 0 Then Me.AddSettingsButton.Visible = True
[code]...
The ClientFileFrm is the main form.I can't seem to reference the clientId variable back to the main form.