Modules & VBA :: Reference To Control In Subform From Query

Oct 10, 2013

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").

View Replies


ADVERTISEMENT

Reference A Control On A Subform In A Tab Control!

Aug 3, 2006

OK. I have searched and searched and every thread dances around similar situations but none seem to address this particular one. I am trying to make a control on a sub form visible/not visible depending on the condition of a control on a main form. The catch is that the control I'm trying to change the state of is on a subform located in a tab control. I've tried a thousand combinations and none seem to work. How do I reference the control on the subform in a tab control?

Main Form: frmMemberMain
Tab Control: TabCtl12
Tab Control Page: 2
Subform: frmChildren
Control on subform: txtRelationship

Can someone please help before my brain explodes!! Thanks! :eek:

View 5 Replies View Related

Reference A Control In A Subform From A Module

Aug 4, 2005

Hi,

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.

Any help would be much appreciated!

Thanks in advance!

View 1 Replies View Related

Forms :: CBO From Main Form To Reference Control On Subform

Mar 12, 2013

Ok, this is what I have:

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.

View 2 Replies View Related

Forms :: Reference Control On Main Form From Subform

Apr 2, 2014

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

But I get 'method or data member not found'.

View 3 Replies View Related

Modules & VBA :: Reference To A Table On Subform

Oct 22, 2013

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.

View 2 Replies View Related

Modules & VBA :: How To Reference A Textbox In Subform

Jul 16, 2013

reference a text box in sub form. I did the same thing for the combo box in it worked perfect. I am not sure why this is not working for textbox.

This is how I referenced it:

[Forms]![MainOrderForm]![CuttingNumForm].[Form]![Style1]
Form: MainOrderForm
Sub Form: CuttingNumForm
Text Box: Style1

I should also mention that "Style1" filed in automatically once a "CuttingNum" field is selected.

View 8 Replies View Related

Modules & VBA :: How To Reference All Records In A Subform

Mar 5, 2015

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?

View 2 Replies View Related

Modules & VBA :: Subform Reference Via Unbound Form

May 8, 2014

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:

Code : Me!Search_blank.Form!MeasureForm_sf1.Form.GetLastVal2

and I got RunTime error 2465, cannot find MeasureForm_sf1

View 4 Replies View Related

Modules & VBA :: Reference Field On Datasheet - Unbound Subform Controls

Jun 2, 2014

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???

View 3 Replies View Related

General :: Open Recordset With A Query That Uses Reference To Form Control - Runtime Error 3061

Aug 2, 2012

I'm trying to open a recordset in vba and I'm getting the 3061 runtime error,Expected 1.

I'm trying to open a recordset with a query that uses a reference to a form control.

Code:
searchtable1 = "qInVisio_RSV"
Set rs = db.OpenRecordset(searchtable1, dbOpenDynaset, dbSeeChanges)

This is the sql of the query:

The highlighted parted is the form referance ( I know it's obvious, just for easier spotting )

Code:
SELECT dbo_FOLIO.FOLIOID, dbo_FOLIO.KIND, dbo_FOLIO.RSVID, dbo_FOLIO.CHKIDATE, dbo_RLIST.ROOMID, dbo_ROOM.ROOMNO, dbo_AGN.LINAPRG
FROM (dbo_ROOM INNER JOIN (dbo_FOLIO INNER JOIN dbo_RLIST ON dbo_FOLIO.RSVID = dbo_RLIST.RSVID) ON dbo_ROOM.ROOMID = dbo_RLIST.ROOMID) LEFT JOIN dbo_AGN ON dbo_FOLIO.AGNID = dbo_AGN.AGNID
WHERE (((dbo_FOLIO.KIND)=101) AND ((dbo_FOLIO.CHKIDATE)>=[Forms]![frmCleaningPlan]![DTPicker]));

also as you can see it's a datepicker control, so the value is a date...

View 2 Replies View Related

Query Criteria Cannot Reference Subform

Jul 19, 2007

Hi,

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]));


Thanks

View 2 Replies View Related

Subform/ Subreport Query Data Row Number Reference

Jul 20, 2005

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?

and finaly

am i going about this the right way?

Any input on this would be greatly appreciated :)

View 5 Replies View Related

Modules & VBA :: Subform In A Tab Control Form

Mar 3, 2015

I have main form (frmProcedures) that has a tab control with 2 pages. One of the pages I have a subform that contains a listbox control controlled by a query.The subform is a search and display form. When I open the subform on it own, it opens up fine. However when I try to open up the mainform, it always prompts me to enter the parameter value. I have to atleast hit "Enter" for the form to open up.Even after hitting the enter key, when I try to navigate to that page, I keep getting the parameter prompt.

Here is the query that populates the listbox control. And the parameter that is prompted is Forms!frmSearchMulti!SrchText that you see in the query below

SELECT Procedures.ProcedureName, Procedures.BusinessLine, Procedures.Manager, Procedures.ApprovalDate, Procedures.NextApprovalDateFROM ProceduresWHERE (((Procedures.ProcedureName) Like "*" & forms!frmSearchMulti! SrchText & "*")) Or (((Procedures.BusinessLine) Like "*" & forms!frmSearchMulti!SrchText & "*")) Or (((Procedures.Manager) Like "*" & forms!frmSearchMulti!SrchText & "*"));

I do have a searchbox that when updated with search string issues the requery to update the values in the listbox.

View 3 Replies View Related

Modules & VBA :: Recordset Referencing Control Value In Subform

Nov 10, 2014

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.

View 4 Replies View Related

Modules & VBA :: Navigation Control Subform Saving

Jul 18, 2013

Access 2010. one of the forms i load into a navigation form is in datasheet view and some vba re-sizes all the columns as it loads in.

However, this then means that when i try to navigate away to another form i always get prompted whether to save the form or not.

because the form is in a navigation subform i can't use:

Code:
DoCmd.Save acForm, Form_NavigationForm.NavigationSubform.Form.Name
' or this...
DoCmd.Save acForm, "my_form"

in both cases i get an error : the object my_form isn't open

View 1 Replies View Related

Dynamic Control Reference?

Feb 6, 2006

is it possible to refer to a control dynamically?

i need to refer to one textbox if the value in a related and similarly named textbox meets a certain condition.

for example:

txt_MMC_Fail_Rate and txt_MMC_Fail_Count

if the (calculated) value in txt_MMC_Fail_Rate exceeds 3%, i need the backcolor of each of these controls to change to hilight the failure to the user.

i'm iterating through the controls collection, but can't figure out how to refer to the fail rate when i'm looking at txt_MMC_Fail_Count. what i hope to be able to do is strip off "Count" from the current control's name and append "Rate", then use that value to refer to the txt_MMC_Fail_Rate control.

is this possible? if so, could someone educate me, because all my attempts have failed...

thanks,
john

(edit: i am aware of the conditional formatting available directly on the control, but prefer not to go that route if possible. due to the number of controls involved, and the fact that documenter does not pick up conditional formats, i prefer to do this in code.)

View 5 Replies View Related

Modules & VBA :: Query Loop - Unable To Convert To Form Reference

Sep 9, 2013

I have a form with 10 combo-boxes. Once user selects a value in CB1- CB2 becomes visible and active. I am trying to run a dynamic query- where the selection of the combo-box is used to select a column from my table called "dbo_animals"

To elaborate: CB1 contains the following values

Code : elephant, giraffe, bufffalo, tiger, lion

Once the user selects elephant in CB1, CB2 becomes active and I select tiger next. So the query becomes like. The process can go on and the user can select up to 10 animals

Code : **SELECT elephant, tiger FROM dbo_animals**

Problem: I am able to create the query with string manipulation- Unfortunately due to the way the loop through controls is set up- The query is unable to convert the text into a reference. If I hard code it as

tempquery = "SELECT [Form]![Animal Finder]![CB1] FROM dbo_animals" MsgBox(tempquery)

It looks like

Code : SELECT Elephant from dbo_animals

This is how I want. But, since i am looping through CB controls, I have it set up as

Code : tempquery = "SELECT" & " [Form]![Animal Finder]![CB" & i & "] FROM dbo_animals"

and this shows up as

Code : SELECT [Form]![Animal Finder]![CB1] FROM dbo_animals

Thereby giving me an error saying that the reference is not valid and asking me for a parameter value.

This makes sense, since it is unable to evaluate the text as a reference.

How do I correct the text into a reference? Or How do I build a query with adjusting columns based off selections from a combo-box and loop through the comboboxes in the form while auto-updating the query?

View 4 Replies View Related

Modules & VBA :: Unable To SetFocus On Main Form Control From Subform

Jan 13, 2015

I'm using form with subform. Main form header contain a combobox. I need to check the combobox is null or not before update a subform filed. If combobox is null then its back to Main form combobox from subform. The code below that I'm trying to:

Code:
Private Sub AssignTo_BeforeUpdate(Cancel As Integer)
If IsNull(Forms!frmDepartmentReview!cboDepartment) Then
MsgBox "You must select Department first", vbInformation
Forms![frmDepartmentReview]![cboDepartment].SetFocus
End If
End Sub

Then I'm getting 2110 run time error

Access can't move the focus to the control cboDepartment.

View 4 Replies View Related

Modules & VBA :: Using Form Combo Box To Control Subform Button Visible Or Not?

Nov 24, 2013

How to use the combo box from the form to control subform button or textbox visible or not?

View 5 Replies View Related

DLookup Returning Circular Reference Warning In Control Source

Oct 15, 2015

I'm working on my first report and am trying to get my textbox, tboJob to show a field value and not the ID. I have tried the following Dlookup in my control source with no luck.

Code:
=DLookUp("[JobName]","Jobs","ID=" & [tboJob])

JobName is the field I want to show from the table Jobs.

View 7 Replies View Related

Subform Reference

Apr 7, 2008

Hi,

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 am trying:

forms!frmSWL!frmSite.Filter = "......."

, but it is not working.

Thanks,

View 3 Replies View Related

Reference A Field On A Subform

Feb 26, 2005

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.

View 2 Replies View Related

Subform Reference Each Row Event

Feb 23, 2006

I have tried and searched as much as i can.

I have a continous subform, a text box which has a date.

For each row i want a button to be visible where the date is blank. If the date is filled in No button. So i thought need an event. But where?

Can you reference row values?

Here's the code, where would it go?

If txtEndDate = Null Then
cmdCheckout.Visible = True
Else
cmdCheckout.Visible = False
End If

View 5 Replies View Related

Forms :: How To Reference One Subform From Another

Oct 24, 2013

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?

View 2 Replies View Related

Forms :: DLOOKUP Needs To Reference Form Or Subform

May 16, 2013

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

[code]....

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved