I have a form (frmSWL) with a subform container on it (subfrom1) which has a source object called frmSite. How do I reference frmSite from another form so I can apply a filter to it??
I have 10 fields on a subform. they are named value1 to value10 consecutively. I would like to loop thru them, and get their values to use in subsequent events. I tried the following to reference them...
Dim iLoop as integer Dim fldVal as control Dim ItemValue as string
For iLoop = 1 to 10 fldVal = ("Forms![Form 1]![Subform 1]!value" & iLoop) ItemValue = fldVal Next iLoop
I also tried a couple of other variations, but cannot get this **** thing to work. Any help would be appreciated.
I have the following bit of VBA which works like a charm :
Code: With CallNotes.Form.RecordsetClone .AddNew !CustomerRef = Me!CustomerRef !Who = Forms.markswitchboard!Text52 !Date = Now() !Notes = "Final Deposit Due on" & " " & FinalDepositDueDate !DiaryDate = FinalDepositDueDate + 1 .Update End With
However, if I try to use this code on a different tab control it just doesn't work.I get Runtime Error 424 object required.I guess I am asking how to reference one subform from another?
I'm trying to reference a control in a subform from a module but I keep getting errors!
Here's what I've tried.. and what error I've been getting:
First try: GetCboEntries = Forms.frmMain!frmSub.Form![cboEntries].Column(1) (where frmSub is the name of the actual form in the subform control) Error: Object doesn't support this property or method
Second try: GetCboActivities = Forms.frmMain!chdMain.Form![cboEntries].Column(1) (where chdMain is the name of the subform control) Error: Object doesn't support this property or method
Third try: GetCboEntries=Forms!NameOfMainForm!NameOfSubform![cboEntries].Column(1) Error: Run-time error '2450': Microsoft Access can't find the form 'frmMain' referred to in a macro expression or Visual Basic code.
Trying to run an append query for a specific record on a subform but won't recognise the subform control.
The Master form is fmSickEdit do I have to reference the Master file in the SQL?
The SQL for the query is:
INSERT INTO tblDisLetter ( SickID, DateAdvisedDisciplinary ) SELECT tblSick.SickID, Date() AS [Date] FROM tblSick WHERE (((tblSick.SickID)=[Forms]![fmsubSickListEditVersion]![SickID]));
I have a form which have a sub form. In the sub form I have a the direct table to update data on it.
Example:
The form has the name of the project and the subform the name of one of the items of the same project and the table present the documents for the particular item.
The users have the option to add or edir docs to this item.
If I would like to reffer to a value they are entering on this table in VBA . how can I do that?
(I would like to present a msgbox when they are entering a date that isn't right on the table for this item.)
By the way, I can't use validation rule because I have a different dates needed per item.
I have a form with a subform. I would like a control in my parent form to uncheck a checkbox control in my subform when that field value is deleted . I can get that to work if there is only one record in my subform but it doesn't uncheck the rest. how to I reference all the records in my subform so all of them will uncheck when I delete that field value?
I have a DLOOKUP which is used to auto populate a field on my Income Commitment Form based on a field on my Expenditure Commitment Form.It works perfectly when you enter a new commitment.Currently you enter a new Expenditure Commitment, save it but don't close it, then from the Expenditure Commitment Form there is is a button to enter a related Income Commitment. You save the Income commitment then close it, then close the expenditure form and you are on the Client screen with both these forms now showing as subforms, both have record selectors.
My issue is, that sometimes the Expenditure Subjective can change, so from the client form you use the record selector to open the Expenditure Commitment and select the correct Subjective, you then save it and close it. You should then click on the Income Record selector which opens the income commitment, but when you re-click on the Combo42 button, it doesn't reselect the Income subjective and I think it is because the Expenditure Commitment which is what it is looking up isn't open. My issue is how do I get the DLOOKUP to work and refer to the Commitment Form if it is a new commitment, or the Subform if I have gone back in through the record selector.Here is the code I have.
Private Sub Combo42_AfterUpdate() If (Me.Combo42 = 1) Then Me.IncomeSubjective = DLookup("[Subjective]", "tblIncomeSubjective", "[ExpSubjective]='" & Forms![frmCommitments]![cmbSubjective] & "'") Me.OtherIncomeConfirmed.Enabled = False Me.OtherConfirmedBy.Enabled = False
I have form named SearchForm and there is unbound subform named Search_blank. Depending on button in menu is used source object of Search_blank. One of the source objects is form named MeasureForm and it has subforms named MeasureForm_sf1 and MeasureForm_sf2. How can I reference public sub in MeasureForm_sf1 from SearchForm? How can I reference public sub in MeasureForm_sf1 form MeasureForm_sf2?
There might be a problem with unbound form. I tried reference public sub named GetLastVal from SearchForm that is in MeasureForm:
Code : Me!Search_blank.Form.GetLastVal
and it was working. Than I tried reference public sub named GetLastVal2 from SearchForm that is in MeasureForm_sf1:
I have a main form "KZ_SEARCH" and within this I have a subform which is loaded when a button is pressed and is populated with query results (based on text entered in a text box). The subform is called "KZ NOTICES Query subform". That all works fine and the query modifies based on the text entered every time the button is pressed. The next stage is that when the subform is loaded I want the user to be able to select a line from the subform and to jump to that record in another form (which also needs to be opened from that selection). The reference for the record to select in the newly opened form would be the first column of the selected line highlighted in the subform (control name "KZ NUMBER").
I am new to this and i may be going about this the wrong way but what i am doing seems to do the job until now.
I am making a form that has a combo box, a few text boxes and a subform subreport on it.
The idea is that the first thing a user does is to select a name form the combo box. this name is then stored as a sring and used to set the forms record source and then the subform's (called window) source object. the string is slightly modified during the process to do this. That part works fine.
The problem arose when i included text boxes to show infomation from the selected Query thatisant show in the window (subform).
After the user selects a name and the name is used to set up the record source and the source object for the text boxes.it then displays in the text boxes the records extra data. however it only displays the first row extra data.And when other rows in the query table are selected the data in the text box stays set as the first row.
I know that this is because i haven't programed in an event that makes the text box data update when the user selects a new row.
i also realise that i would need to have some way of know what row of the quiery table the user is looking at to be able to update the text boxes.
my questions are
Is there a way to tell what row of a query table in the subform is selected ?
Is there an event similar to on selection of row or something like that that i could use to reload the text boxes?
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 have a Main form 'frmEmployeeInjury' with a subform 'frmInjuryDetails'.On the subform is a date field 'dteDateofInjury' and on the main form a command button 'SaveRecord'
What I am trying to do is hide the command button on the main form until a date is entered in the 'dteDateofInjury' field.I have looked online and found information on main form and subform referencing, but I can't follow it very well without examples.
Code:
Private Sub dteDateofInjury_AfterUpdate() Me.Forms![frmEmployeeInjury]![SaveRecord].Enabled 'Me.Parent.cmdSaveNewInjury.Visable 'Me.Parent.cmdSaveNewInjury.Enabled End Sub
I have placed an unbound subform on a form. I have the following code which loads in different datasheet to the subform:
'Loads in NewQuery Me.data.SourceObject = "query.NewQuery"
'Loads in NewQuery2 Me.data.SourceObject = "query.NewQuery2"
etc.... this works fine to show these queries but i want to know how to reference the fields on the datasheet.
for example one of the fields in NewQuery is "ID"... When clicked i want to run code... normally on bound subform i could go for example ID_Click()... msgbox(me.ID)
how can i reference these other fields on unbound???
I have a form with a subform. I have an event on dbl-click on the subform's detail section, I want to display yet another form - frmDatePopup depending on a value in that subform. frmDatePopup has an Eval(Forms!frmDates!Start) for criteria for my date field. The problem is that when I dbl-click on the subform's detail section, frmDatePopup comes up blank, as if it ignores the Eval statement. Any suggestions on what I need to change to make this work? Thanks.
I'm trying to code an event that would occur when a user double-clicks on the Record Selector of a subform. I want it to then open a form that would provide additional details about the record selected in the subform. I can't find documentation to tell me (1) where to put the code, i.e. subform double-click event vs. subform detail double-click event, etc.; (2) how to reference the record id of the selected record for use in the filter for the form that is going to be opened (the underlying query contains the ID for the record). Can anyone help or point me to documentation?
I have some code for the Key Down event for particular column in my subform
Private Sub Sample_ID_KeyDown(KeyCode As Integer, Shift As Integer) Sample_ID = Nz(DMax("Sample_ID", "Sample_Sheets")) + 1 mTo = Nz(DMax("mTo", "Sample_Sheets")) + 1 mFrom = Nz(DMax("mFrom", "Sample_Sheets")) End Sub
This works, however it also work when I press Key Up, changing what the key down previously did. I do not want it to do this. I have nothing entered in the Key up event for the form properties.
I have a query in a subform on the main form. I have a search box that updates the subform/query as you type something (using the On Change event). You then click on the record you want which transfers the information to the appropriate text boxes (one of these txt boxes is the clientID I talk about below) located next to the search box.
I have a Contacts subform/query much like the serarch box I created and I am using a txt box (on the main frm) clientID (which I get from the above process) to filter the contacts.Now when I pass the ID to the txt box on the main form I am having trouble getting a event to trigger and update the subform/query correctly.
I am using VBA to create a simulated Click action which seems to work but is not updating the Contact subform/query, it is just resetting the subform/query. If I manually click on the txtbox with a ID in there all works wonderfully. I have attached the database. I made the clientID and btn next to it visible(this would not be visible normally).I just realised I left a button on the main form next to the clientID txt box just ignore that and click on a client then the clientID txt box to see how it updates the contacts subform..
On a subform, I have a text box control with an AfterUpdate event handler. The subform itself has an AfterInsert event handler.
If a user enters data into that tb control for a new record and then moves on (tab or click elsewhere), the AfterUpdate fires and does what it should, including setting Me.Dirty=False immediately before it completes. Then the form's AfterInsert event fires and does what it should, but finishes by returning program control to the ErrorHandler label within the control's AfterUpdate routine, reporting either an error 2101 (The setting you entered isn't valid for this property) or 3270 (Property not found). The form's AfterInsert handler does have its own ErrorHandler label, but it is not being executed.
Private Sub Form_Current() If Not Me.NewRecord Then With Me.Q_Subform.Form .RecordsetClone.FindFirst "N=" & Me.N .Bookmark = .RecordsetClone.Bookmark End With End If End Sub
The problem is that when the Q_Subform has no records I have the error 3021.
How can manage it. It's the last step before ending My db
I am starting to explore VBA and Modules. I recently found a relativly simple way to add an Audit Log to a database without adding two tables for each table as outlined by Allen Browne.
I used a set of code from fontstuff.com and it works great, except when using a sub form. I belive that it is most likely because the use of the Tag property looks at the subform as a control but it holds no value. I am thinking the VBA needs to be altered or the BeforeUpdate command need to specify what form to look in.
The Before Update code is
Code:
Public Sub Form_BeforeUpdate(Cancel As Integer)
Code: If Me.NewRecord Then Call AuditChanges("SubForm_ID", "NEW") Else Call AuditChanges("SubForm_ID", "EDIT") End If End Sub
AuditChanges is the Module Event name and CustomerID is the unique identifer for a Subform.
I have parent form and child subform. one field in the parentform is calculated on sum of records on the childsubform when the parent form loads initially the value in the calculatedfield is 0 then it shows the correct value when the childsubform value is populated i have another-field i want to change the property of the onotherfield.backcolor= RGB(0,0,255) when calculatedfield.value<0 but its taking the initial value(0) not the calculated onewhich event shall i invoke on the form so that it waits the subform to complete then fires ... i tried current, load, activate events .. with no success.