Label Name Referring To Subform
Jul 3, 2006
Just a quick question, I can't seem to get this right (as usual :confused: )
I have a form and I want the label in the header to display the text from a field in a related subform. I have tried the following syntax to no avail:
=[Forms]![sfrmCompanyName]![LastName]
Any suggestions
Thanks in advance
Nicolas
View Replies
ADVERTISEMENT
Nov 15, 2004
I know how to refer to a control on a form by using [forms]![formname]![controlname], but can anyone help with referring to a subform.
I have a subform called subPrograms, on which is a combo box whose contents need to be filtered depending on the selection from another combo box on the main form.
The combo box on the main form is cboDivisions.
The combo box on the subform is cboPurchasers
Main form is called frmMain
Subform is called subPrograms
The user is supposed to select a Division, and then depending on that selection the contents of cboPurchasers will change to only show those that are within that same division.
I would also like to know how to update the cboPurchasers when the cboDivision has been selected? Can someon help?
I hope that this is enough info.
View 2 Replies
View Related
Nov 30, 2006
I want my subform to allow additions. I would like the default value for one of the fields in the subform to be the value chosen in the combo box that is used to select which records are shown in the subform. The row source for the combo box is
SELECT tblLicensee.LicenseeID, tblLicensee.[Licens#] FROM tblLicensee;
where LicenseeID is the key field and Licens# is what is displayed.
If I refer to the combo box for the default value for that control on the form…
=[Forms]![frmFindRecord]![Combo37]
the key value (LicenseeID) is entered as the default instead of the value displayed in the combo box (Licens#). How can I set the default value to record the Licens# instead?
View 1 Replies
View Related
Mar 3, 2015
I have a form with a subform that has a table on it. The subform table is a price list with the fields Description, Details (which is hidden as it's too big for the table) and Price.
I want to be able to double-click on a chosen item from the table to display a pop-up showing the same details but with the Details field shown. I have the pop-up in place but I am struggling with displaying the chosen information.
How do I reference the fields on the chosen line in the table?
View 6 Replies
View Related
Jul 21, 2014
I have a form named frmMain that contains five buttons that lead to subforms, one of which is named frmDeceased.
In frmDeceased, I needed to create a combo box that relied on selections from the combo box before it. I was able to do this successfully in frmDeceased, but then today when I opened the database and opened frmMain, I realized that the query fails when frmDeceased is opened via frmMain. It works perfectly if I just open frmDeceased directly.
The first combo box is ROHE and the second is Iwi (which is dependent on the Rohe selected).
The query for Iwi has this criteria: Forms!frmDeceased!cbo_ROHE
When I open frmDeceased through frmMain, I get the 'enter parameter value' message showing "Forms!frmDeceased!cbo_ROHE".
I tried changing this query to: Forms!frmMain!frmDeceased!cbo_ROHE, but it didn't work.
View 14 Replies
View Related
Mar 5, 2013
I have an Access 2010 application and I'm having trouble referring to properties in my subform withon a Navigation form. Based on a selection in a Combo Box, I need to change the filter on the subform. The relevant forms are:
Main Navigation Form = frmAdminNav
"Standard" Navigation Subform = NavigationSubForm
My Subform = frmShowInventory
How do I refer to the Filter property on frmShowInventory?
View 2 Replies
View Related
Aug 14, 2014
I have a form with a subform which resides in a tabbed control. In that subform, I have a textbox in the footer that sums values in the detail section of the subform.
I have a textbox on my main form that should display the same data that is in my subform footer textbox, but it is giving me the #name? error.
This is the expression in my subform footer textbox (which returns the correct result):
TxtSubtotalHQPCalc -
=Sum([ActualHQPCalc])
And the expression in my main form textbox (which returns #name?):
txtActualHQPValue -
=([subfrmHQPProject].[Form]![TxtSubtotalHQPCalc])
I have verified that my subform name and textbox names are all accurate. This is very frustrating because I am using this exact same method in a different database with no problems!
View 3 Replies
View Related
Feb 22, 2013
I believe I did this before awhile ago but for some reason I keep getting an error.
I have a Mainform (frmMain) that has a Subform (frmSub). On frmSub I have 2 comboxes (strCom1 & strCom2) one is set to invisible (strCom2.Visible = No).
So using the "On Open Event" of frmMain I want make strCom2 visible if strCom1 = "Read Only". Ofcourse I will also need to place the vba on the On After Update event. Below is what I have so far but doesnt work.
I get Run-time Error 2427 "You enetered an experssion that has no value"
Code:
Private Sub Form_Open(Cancel As Integer)
If Me!frmSub.Form!strCom1.Value = "Read Only" Then
Me!frmSub.Form!strCom2.Visible = True
Else
Me!frmSub.Form!strCom2.Visible = False
End If
End Sub
View 5 Replies
View Related
Apr 17, 2013
Go to frmInvoice, and you'll see a Net Total box (txtNetTotal) . It's control source is linked to a textbox in the subform fsubInvoiceDetails2 called txtStocktotal. It basically just pulls up all the costs associated with that InvoiceID.
The reference mechanism is as follows: =[fsubInvoiceDetails2].[Form]![txtStockTotal].Now...sometimes this works and sometimes it doesn't! Sometimes i've had to use: =forms!fsubInvoiceDetails2!txtStockTotal.
It seems to be very temperamental at times and i'm not fully confident if this can be explained.By way of note, I use express builder normally to input these statements: I go to Forms > ALL FORMS > fsubInvoiceDetails2 > txtstocktotal.
View 2 Replies
View Related
Nov 1, 2004
Can i have a label appear if a value in my subform is null.
i have a report called "ModelFinalReport"
which has a subform called "ModelFinal"
And in that subform a textbox called "VAT"
i also have a label on my main form that i want to appear if the text box "VAT" returns a null value. but be invisible if "VAT" returns a true value.
how should this be written please.
Cheers
Andy
View 2 Replies
View Related
Feb 27, 2014
I have a form with 3 subforms on it based on individual queries.
If there is no data to display the subforms are blank.
I want to display a Label on the subform saying that there is no data to display?
View 6 Replies
View Related
Nov 16, 2005
Hi guys,
I have a form (frmMain) which contains 3 subforms and they are being set to visible at different stages of application run (depending on the options selected).
In subfrm_Main_options i have 3 buttons, clicking on 'Job Review' will make the subfrm_Search visible. In the subfrm_Search i have 2 labels, 'View Jobs' and 'View Report' and I only want the 'View Jobs' to be visible!
I have tried setting the visible property of this label to False in the subfrm_Main_Options but its giving me an error (saying the form subfrm_Search is closed or does not exist in the database!). I also tried using a Global Variable (ViewJobs - declared in module mdlPublicVars) and set it to True once the 'Job Review' is clicked in the subfrm_Main_Options form, and then look at this in subfrm_Search and then display the correct label. However after trying to put this code in various events such as, On Open, On Got Focous, On Activation, ... i didnt get the result i wanted!
Can any1 please help me out with this. I would be really grateful!
PS. The buttons appearing on the form are placed on the frmMain, I did that to see if it appears on the main form but they must be in subfrm_Search!
The database is attached!
Thanks, Maisam
View 1 Replies
View Related
Nov 16, 2005
I sent a post earlier today about making a label visible in a subform! I am still working on it but still no progress!
I have a different scenario (its the same thing but trying to explain the method i'm working on):
I have one main form (frmMain) that contains 3 subforms, say subfrm1, subfrm2 and subfrm3. On Open only 1 is visible and 2 and 3 are invisible (however they are open and loaded).
By choosing an option on 1 subfrm2 becomes available! When choosing an option on subfrm1 a boolean called 'XXX' is set to true. Now i want one particular label to become visible in subfrm2 if 'XXX' is true! To do this i need to write a code to be executed when subfrm2 is appears on screen! The problem is this form is already open so how and on which event of subfrm2 can i write the code???
At the moment i'm trying to refresh subfrm2 (by using code in subfrm1) and I have placed my code on the On Load event of subfrm2. I thought this way the form will reload and the On Loand event will pick up the new value for boolean XXX and set the label to visible! Thats the idea anyway... here is the code i have in subfrm1:
XXX = True
Forms![frmMain].subfrm2.Form.Refresh
subfrm1.Visible = False
subfrm2.Visible = True
I'm not sure if refreshing the subform will result in On Load event to be executed! And i'm not even sure that the code for refreshing subfrm2 is correct. Can any1 help me with this?
I have attached the actual database on my previous post sent today, if you prefer to look at the whole thing and get a feel of the problem!
View 1 Replies
View Related
Aug 4, 2006
I have n horizontal labels named Label_1 to Label_n. I'd like to assign values to the label captions by using a loop.
Something like:
For i = 1 To n
Set Label_i.Caption = i
End
However, this doesn't work. Message "Object required".
Any suggestions?
View 1 Replies
View Related
Jan 4, 2005
hiya..how do i refer to a combobox value from a criteria in a query??
i.e. criteria for a field in query = combobox value in a certain form
View 2 Replies
View Related
Sep 25, 2007
I am new to access and am having troubles figuring out if statements. I want an if statement in a table that says if column 1 = "whatever" then column 2 = "YAY" else column 2 = "NO".
How would I apply this to a table?
Also I have a table that has one column it is a list of codes. In another table there are 2 columns column 1 has a code i want column 2 to say if column 1 code is found in the list of codes from the other column the put "MATCH FOUND"
Thanks,
Mike
View 12 Replies
View Related
Sep 27, 2007
Column A Column B Column C Column D
1*010101001000000 CF 5
010101002000000 RF
010101002000000 RF
010101029000000 CU
1*010101001000000 CF 10
010101351010000 RF
2*010101354000000 CF 11
2*010101354000000 CF 13
010101358000000 CY
1*010101001000000 CF 5
010401328100000 CF
NOTE in the actual data won't be there it is just to show you what I am referring to.
Is there any way in another column in a query to say if Column A repeats itself somewhere else in Column A AND if those two that are repeated both have a "CF" code add column C (which is just an amount for each number)
So for example in this data there are 2 numbers that repeat themself that have CF codes. For these I would need to total them in column D for the first number resulting in:
Column A Column B Column C Column D
1*010101001000000 CF 5 20
010101002000000 RF
010101002000000 RF
010101029000000 CU
1*010101001000000 CF 10
010101351010000 RF
2*010101354000000 CF 11 23
2*010101354000000 CF 13
010101358000000 CY
1*010101001000000 CF 5
010401328100000 CF
Any ideas?
Thanks,
Mike
View 14 Replies
View Related
Jan 26, 2006
Hello, I am using an IIF statement in my SQL criteria, and was wondering "if" it was still possible to reference a column within a combo box... here is one iif statement
Like IIf(IsNull([Forms]![fSampleSearch]![cboCustomerName]),"*",[Forms]![fSampleSearch]![cboCustomerName])
I want to refer to the third column of cboCustomerName... How would I do this ?
View 8 Replies
View Related
Dec 8, 2004
Hello,
I'm trying to write a formula/program that will look at a table, look at the date of each record, and sort out and group the records by week (in this case, Sat.-Friday). However, in order to do this, I'm assuming that I must be able to have the program look at, not only the date of the current record, but also the date of the records before and after the current one. What would be the easiest and most efficient way of writing the references? Thanks!
G
View 1 Replies
View Related
Jan 2, 2008
Hello all...Happy New Year!!
I have obtained some VB code shown below which adds an icon to the windows task bar as I intend to put some additional code behind this that displays messages near the clock when something happens in the database.
The problem I have is that the code does add an icon but the icon is literally blank. i.e. it makes an additional icon space but does not display any picture.
The code is not actually for VBA so I need to tweak it. I am struggling with telling it which icon to display. Does anyone know how to refer to the application icon using code??
The code I am working on is: (there is also a module but I will post this if you need it.)
-------------------------------
Private Sub AddTrayIcon()
Dim nid As NOTIFYICONDATA
' nid.cdSize is always Len(nid)
nid.cbSize = Len(nid)
' Parent window - this is the window that will process the icon events
nid.hWnd = frmSystray.hWnd
' Icon identifier
nid.uID = 0
' We want to receive messages, show the icon and have a tooltip
nid.uFlags = NIF_MESSAGE Or NIF_ICON Or NIF_TIP
' The message we will receive on an icon event
nid.uCallbackMessage = 1024
' The icon to display
nid.hIcon = frmSystray.Icon
' Our tooltip
nid.szTip = "Always terminate the tooltip with vbNullChar" & vbNullChar
' Add the icon to the System Tray
Shell_NotifyIconA NIM_ADD, nid
' Prevent further adding
cmdAddIcon.Enabled = False
End Sub
Private Sub cmdAddIcon_Click()
AddTrayIcon
End Sub
-------------------------
This is the code that is the problem. I dont think VBA has this function so I need to tell it where to find the .ico file I use for my database.
Thanks folks.
View 2 Replies
View Related
Aug 23, 2006
How can I refer to a form by using its index number? Also how can I retrieve an index number of a form?
(I'm opening multiple instances of the same form and read that the only way to refer to those instances is by using their index number. I found some solutions that use hWnd as well but I can't get any further support on it as far as referring to a form by using the window handle so I'm trying to capture and then use the index number)
View 4 Replies
View Related
Jun 9, 2013
I have the following setup:
A main form - named [formMain]
On [formMain] I have a tab control - named [tabMain]
[tabMain] has 3 pages named [pageOne], [pageTwo] and [pageThree].
On [pageThree] I have created a subform named [formSub].
On [formSub] there is a tab control named [tabSub].
Now what I would like is to make [tabSub] (in)visible if the user switches from [pageOne] or [pageTwo] to [pageThree].
Code:
Sub tabMain_Change()
How do I refer to [tabSub] from within this subroutine? I am trying something like:
Code:
Forms![formMain]![pageThree].Form![tabSub].Visible = False
but it is not working. What should be the correct way?
View 2 Replies
View Related
Dec 3, 2012
I would like to know if it is possible to refer to a field even tho it is not in a form, i.e.,
PHP Code:
strSql = "UPDATE tblItems " & _ "SET StockQTY = ([StockQTY]+1) " & _ "WHERE ItemsID = " & [ItemsID] & ""Â
The [ItemsID] is actually on the form as a txt box. but i dont really need it there for any other purpose other than the vba above.
In the form i have a field that is in the form as a txt box that has a relationship to the ItemsID. i have attached a image of the relationship.
The field that is in the form is tblOrdersItems.OrdersItemsID and i also have tblItems.Items. so rather than adding another meaningless txt box to the form(ItemsID) i would like to be able to use the relationships to get the correct ItemID ...
View 1 Replies
View Related
Aug 5, 2006
I need to trim a lot of tables. Is it possible to delete table fields with reference to the field number instead of field name?
The command 'tblMyTable.Fields.Delete ("FieldName")' takes a string (field name) as input. I rather like to - in a loop - delete say,
Sub DeleteFields()
For i = 40 To 60
tblMyTable.Fields.Delete Field(i) ' Not correct syntax
Next i
End Sub
thh
View 2 Replies
View Related
Oct 22, 2014
I have a form which contains fields from my main table and also has a subform containing a query based on a filtered list of my main table.
I have a combobox on the form to select a name and pass it to the query to filter on.
The list of names is in a table called tblnames which has 2 fields, name and ID. I have linked the ID field on this table to a field called nameid on my main table which is a numeric field (and that allows be to select a name from a list when I enter data into my main table.
The xox is unbound, control source empty and row source set to tblname.
The combobox is only showing a list of numbers (I assume they are the id field from tblname). Yesterday I had the list of names showing and I checked a backup and the only difference I can see is the row source property refers to the name field in tblname but I don't know how I got it there. When I click on the list box for row source I only get offered a list of my objects.
View 10 Replies
View Related
Sep 30, 2013
I have a simple date stamp that works great in a private sub within a form. (error handling removed for clarity)
Code:
Private Sub btnDateStamp_Click()
' UserInit is global variable
Me!Notes.SetFocus
Me!Notes = Chr$(13) & Date & " - " & Time() & " - " & UserInit & _
" -" & vbCrLf & Me!Notes
[code]...
I am rewriting it as Module function that is Called from various forms, to save space. The function receives the parameters varFormName and varControlName. I wish to write the results of the function back to a memo field on the form.I am stumped at the get go by the need to refer to the Forms controls with a full reference instead of the Me command.
Code:
Function DateStamp(varFormName As String, varMemoName As String)
'varInitials, varFormName, varMemoName are global variables
Forms!varFormName.Controls!varMemoName.SetFocus ' Error here
'Me!Notes = Chr$(13) & Date & " - " & Time() & " - " & varInitials & _
[code]...
how to refer to the forms control's with their full reference, from within the Module's function, the rest will fall into place.
View 3 Replies
View Related