Naming a subform from a main form

I'm having a heck of a time getting to a control on a sub form from a main 
form.  I use the following convention

Forms![frm MAIN_FORM]![frm SUB_FORM]![CONTROL_NAME]

However when I run the code,  I get an error message informing me Access 
cannot find the field named [frm SUB_FORM].  Then I tried taking the mainform 
out of the line leaving me with 
Forms![frm SUB-FORM]![CONTROL_NAME]

Then the message reads can find find the form named frm subform.  As far as 
I can tell the subform is opened. I can see it.

 I'm baffled.  Can you help me?
0
Utf
6/25/2007 10:38:01 PM
access.formscoding 7493 articles. 0 followers. Follow

4 Replies
585 Views

Similar Articles

[PageSpeed] 23

Common problem!!

Open your main form in design view. Select the border around the subform. 
This is the subform control. Open Properties and Go to the Other tab. Look 
at the name property for the subform control. This is what you use in your 
expression NOT the name of the subform! Let's say the name is "Jimphily". 
The syntax to refer to the control, Control_Name, on your subform is:
Forms![frm MAIN_FORM]!Jimphily.Form![CONTROL_NAME]

By the way, it takes two steps to set focus to a control on a subform from 
the main form. You must forst set focus on the subform control and then set 
focus on the control on the subform:
Me!Jimphily.SetFocus
Me!Jimphilly.Form![Control_Name].SetFocus

PC Datasheet
Providing Customers A Resource For Help With Access, Excel And Word
Applications
resource@pcdatasheet.com




"jimphilly" <jimphilly@discussions.microsoft.com> wrote in message 
news:2C0E8CC1-A327-484E-AD1E-125242E6D0D6@microsoft.com...
> I'm having a heck of a time getting to a control on a sub form from a main
> form.  I use the following convention
>
> Forms![frm MAIN_FORM]![frm SUB_FORM]![CONTROL_NAME]
>
> However when I run the code,  I get an error message informing me Access
> cannot find the field named [frm SUB_FORM].  Then I tried taking the 
> mainform
> out of the line leaving me with
> Forms![frm SUB-FORM]![CONTROL_NAME]
>
> Then the message reads can find find the form named frm subform.  As far 
> as
> I can tell the subform is opened. I can see it.
>
> I'm baffled.  Can you help me? 


0
Steve
6/25/2007 11:00:05 PM
jimphilly wrote:

>I'm having a heck of a time getting to a control on a sub form from a main 
>form.  I use the following convention
>
>Forms![frm MAIN_FORM]![frm SUB_FORM]![CONTROL_NAME]
>
>However when I run the code,  I get an error message informing me Access 
>cannot find the field named [frm SUB_FORM].  


Forms![frm MAIN_FORM]![frm SUB_FORM].FORM![CONTROL_NAME]

Note that [frm SUB_FORM] needs to be the name of the subform
control on the main form.  The name of the form object being
displayed in the subform control is irrelevant.

-- 
Marsh
MVP [MS Access]
0
Marshall
6/25/2007 11:01:34 PM
"Steve" <sorry@private.emailaddress> schreef in bericht =
news:VNXfi.1051$rR.565@newsread2.news.pas.earthlink.net...
> Common problem!!
>=20
> Open your main form in design view. Select the border around the =
subform.=20
> This is the subform control. Open Properties and Go to the Other tab. =
Look=20
> at the name property for the subform control. This is what you use in =
your=20
> expression NOT the name of the subform! Let's say the name is =
"Jimphily".=20
> The syntax to refer to the control, Control_Name, on your subform is:
> Forms![frm MAIN_FORM]!Jimphily.Form![CONTROL_NAME]
>=20
> By the way, it takes two steps to set focus to a control on a subform =
from=20
> the main form. You must forst set focus on the subform control and =
then set=20
> focus on the control on the subform:
> Me!Jimphily.SetFocus
> Me!Jimphilly.Form![Control_Name].SetFocus
>=20
> PC Datasheet
> Providing Customers A Resource For Help With Access, Excel And Word
> Applications
> resource@pcdatasheet.com

Hey Steve,=20

Look at the stats (Statcounter.com) to see the damage you have done to =
yourself.=20
Every time the link is shown, more and more people are reading about =
you.
http://home.tiscali.nl/arracom/SteveStats.html

Since you have been posting 'nice' the last couple of days the =
'answering-machine' stops for now.
We will be watching you though...

ArnoR
0
StopThisAdvertising
6/26/2007 9:05:34 AM
Steve

Thanks for the help.  This will save me tons of time in the future

"jimphilly" wrote:

> I'm having a heck of a time getting to a control on a sub form from a main 
> form.  I use the following convention
> 
> Forms![frm MAIN_FORM]![frm SUB_FORM]![CONTROL_NAME]
> 
> However when I run the code,  I get an error message informing me Access 
> cannot find the field named [frm SUB_FORM].  Then I tried taking the mainform 
> out of the line leaving me with 
> Forms![frm SUB-FORM]![CONTROL_NAME]
> 
> Then the message reads can find find the form named frm subform.  As far as 
> I can tell the subform is opened. I can see it.
> 
>  I'm baffled.  Can you help me?
0
Utf
6/26/2007 3:35:04 PM
Reply:

Similar Artilces:

form option buttons
I am trying to make my spreadsheet keyboard and screen readable. What do I need to do to make my form option buttons accessible? At the moment they are not seen by a screen reader and I am unable to tab to them or select them with any thing other than a mouse click. have searched the help, but accessibility always seems a low priority :-( Lynn Define accessible. Have you created a form in VBA or is your form a tab in your spread sheet. Are the option buttons from the forms toolbar or from the control toolbox. Can you click on them wiht a mouse. Are you having trouble tabbing...

Issue with displaying image on form
Access 2007 I am able to get my form to display a unique linked image for every record. The image displayed is based on the name of the file stored in a text field - [CAD FILE]. The problem I am having is that if I am on a record then go to another record, if a file doesn't exist matching what is in [CAD FILE] it will continue to show the image from the previously viewed record. What can I do to get it to display my default file ("-.jpg") if there is no file name matching [CAD FILE]? (yes, the file is named "-.jpg"; is this a problem for any reason?) T...

Outlook 2003 -Error:Server Name cannot be found?Where is Sve Name
I'm unable to send an email out. I get: Send/Receive Error Task POP3. Receiving error. Server name cannot be found on Network. Where do I need to look to get the right Server name?? desilu611, you wrote on Sat, 4 Mar 2006 12:24:27 -0800: > I'm unable to send an email out. I get: Send/Receive Error Task POP3. > Receiving error. Server name cannot be found on Network. Where do I need to > look to get the right Server name?? You need to ask your provider what's the name of the server. Search on your provider's website; the most holds instructions how to cre...

word 07 won't change the open file to the name I just "saved as"
I am new to WOrd 07, but am familiar with 97. If I open a file in and old format and then save it using "save as" and even save it to the new format, why doesn't it change the name of the file I am working on to the new file name? I also get a second word window with the original file opened. Part of the "Save as" is to change the name. You must do this yourself as no one else has the foggiest notion what your desire. "rgw1085" <rgw1085@discussions.microsoft.com> wrote in message news:121620EB-B1B6-4182-B9AE-DFD68BAA5879@microsoft.com... ...

Navigating forward or backwards through forms
We have revised our Access Database that we use for storing registration data and one of the new features is that registrations that are completed by customers online, then sent to an email box as a text file, are then imported into the database using the software, Email2DB. We then validate each one, using a form that was created in our database. What happens when you open the database is a combo box pops up (I hope I'm using the correct language for this) that displays all the pending registrations (registrations received since you last used the database) -- you can select ...

form in microsoft access
http://wikisend.com/download/630954/SampleDatabase.mdb I have database on here: one table- one form - in microsoft access I the form is a payroll form- i want to have users enter data during the week and on Friday hit a submit button that closes the form and closes the users access to that record. When they open form again it is to input data for next week. user needs to be able to view, add, and change data during week. thank you buddyr, I'm sure I understand the *question*... Did you want one us *volunteers* to download your database and make it work and then it back ...

Printing protected Form in Word Mac 2008 & Office Documentation
I received a form to be filled; filling the form is no a problem. I can see on the screen AND in preview mode the full form and its filled content. However, as soon as I want to print it I just get the template form with statements as {FORMTEXT} statements and so on.... Saving or printing as .pdf is he same !!!! Unfortunately, I have lost my original CD (assume that the documentation was in there) I just have my tiny yellow box with its barcodes and my invoice...... Is there a .pdf doc set of office 2008 avail somewhere ? I'm lost and there is nothing related in the OnLi...

How to make a form behave like msgbox
I have a 'Mass Email' button. When clicked, it brings up a modal popup form. Use can read the certification paragraphs, scroll down and click 'OK' button which closes the form. Then, the rest of my code should run. How to holt the code from running like msgbox after user clicked OK button on the form? The form is based on a table with single memo field and the form will be resued in other places as well. Thanks. Open the form like: docmd.OpenForm "yourFormName",acNormal,,,,acDialog If you also need to use values of the modal popup in the calling code y...

Seach Query in a form
I want to make a form that i can chose an account name from a combo box and all the info on that account shows up. How do i make the combo box search for the info based on what i choose? just make a query that uses two fields: primary key and the account name save it, call it "qrySearchAccounts". add a combo box with the wizard and select that query you just made as the data source. Make sure to hide the primary key field when it asks you so. give the combobox a name like "cmbSearchAccounts" Then I would add this code to the 'after update' event Private Sub...

Form not showing correct record order
I created a form with a subform that shows the related records. For all 7 main categories there is a list of items which show up alphabetized by level and title. The data was entered in the table sorted by level and alphabetized by title. When I pull up any of the categories except one the data shows correctly. In the one category, for one level only, the data has records out of order. The first 15 or so records do not show up until after the 30th record. All of the records are in order up to that point, and including the 15 that are out of sync. I cannot determine any reason behind the...

How to change the index/indexer server back to its old name??
Our WSS search server (Search Server Express I think) thinks its server is called X instead of Y. Any attempt to work with the crawling rules results in an error, it thinks the search service is offline, though search service really is running. Is there any way I can get the search server to know that it should look for a server called Y instead of X?? Thank you... ------=_NextPart_0001_8F0E7021 Content-Type: text/plain Content-Transfer-Encoding: 7bit First I would add a host file entry or a DNS entry for the old name to get things back up and working as a temporary measu...

Add New Broker Name and Move existing accounts into new Broker
MS Money 2007: In a single download MS Money downloaded accounts that contained funds for one Roth IRA and 2 529 college savings plans. All three accounts downloaded under one broker name so that I cannot see the indivual total sums of the three accounts. Each plan contains 8-10 different funds. I want to move all the Roth accounts under a single broker name such as "American Funds Roth". One of the College savings plans under another broker name such as American Funds College 529 Victoria, and the other college savings plan under a third broker name such as American College s...

Limit rows in subform based on field in main form
I have a main form that has a number field (this field inidcates the number of seats available). I want the subform to only allow the user to enter data in rows that are equal or less than than the number field in the main form. please help with code and best place to enter. many thanks!!! cynteeuh wrote: >I have a main form that has a number field (this field inidcates the number >of seats available). I want the subform to only allow the user to enter data >in rows that are equal or less than than the number field in the main form. > >please help with code ...

Error message when adding a name
I get the following errors when trying to add a name to a chart using my macro. Code copied directly from recorded macro ActiveSheet.ChartObjects("Chart 1").Activate ActiveChart.SeriesCollection(1).Name = "=A1" run-time error 1004 Application defined or object-defined error. Why is it not working? Thanks Try this instead: ActiveChart.SeriesCollection(1).Name = _ "=" & Range("a1").Address(external:=True, _ ReferenceStyle:=xlR1C1) Bob Flanagan Macro Systems http://www.add-ins.com Productivity add-ins and downloa...

Automating Forms template
Greetings, I am trying to figure a way to create a shortcut button to apply to an Outlook Toolbar that would pull-up a form I have created for a group of users that need to have an "enhanced" Journal Entry form. Is there a way to Macro this or just click on the Template without having to go to Tools-->Forms-->Choose Form and then try to find the form that they want. I am dealing with people that are not computer savvy so the easiest way to achieve this would work best. Any help is greatly appreciated. -- Thank you for your time and attention to this matter, Robert ...

Editing a Form Template
In Word 2003 I was able to "unlock" a template form and edit the text, header, etc. With Word 2007 everything is grayed out and I cannot edit in any way shape or form. I went into options and attempted to change a few things with no success. I would greatly appreciate any help. thank you. Display the Developer tab (Office button | Word Options, Popular: "Show Developer tab in the Ribbon"). On the Developer tab, click Protect Document to display the Restrict Formatting and Editing pane. Use the Stop Protection button to turn off document protection. Edit th...

Dynamic UI
Hi, Sorry if this is a cross-post. Wondering if there is any way to genrate Windows UI from an xml file just as one would load a Web UI as HTML from an XML using XSLT. Please do let me know if you have any ideas. Assume that the xml contains UI info (i.e., which is the control to display the info on etc). One obvious, but tedious way is to manually parse the xml and generate controls using new() and fill in data, but am looking for more structured ones. TIA Krishnan Thanks Krishnan Hi Krishnan, Thanks for your post. Based on my understanding, you want to dynamically serialize and des...

Memo Box Resize in Form View
I'm going to cut and paste text into a form and would like the form box to automatically resize to fit the text being pasted in full view. Is there a way to have my Memo fields to automatically resize? Thanks (B^>)-]=[ "WSR" <wsr203@hughes.net> wrote in message news:%23tJXNha1KHA.5972@TK2MSFTNGP06.phx.gbl... > I'm going to cut and paste text into a form and would like the form box to > automatically resize to fit the text being pasted in full view. > > Is there a way to have my Memo fields to automatically resize? See if Step...

Macro must return the name of the button
Hi there, I want to a macro to display the name of the button (or object) from where I am calling that macro. Anyone an idea? thanks, Derek What sort of button (userform, worksheet forms, worksheet control toolbox)? -- HTH Bob Phillips (remove xxx from email address if mailing direct) "Derek Brussels" <Derek Brussels@discussions.microsoft.com> wrote in message news:8441F83B-89DC-4515-A643-CE8F258DFC1F@microsoft.com... > Hi there, > > I want to a macro to display the name of the button (or object) from where I > am calling that macro. Anyone an idea? > &...

Automatic name recognition problems in to/cc/bcc fields
When I type in a recipient's address in the to, cc or bcc fields, outlook remembers certain names that were entered in the past? How can I clear the names that are somehow saved in memory? I have some names that are listed with invalid email addresses, that gets picked up. Can someone help!! State your Outlook version and whether you are referring to autocompletion (before you Tab out of the To: field) or autoresolution (after you tab out of the To: field). -- Russ Valentine [MVP-Outlook] "Aaron Shumaker" <anonymous@discussions.microsoft.com> wrote in message news:0...

using add query with subform fields
I am trying to run an add query and add data from a running subform into a table. everything is working fine except for the fact that only the first row of data from the subform is being added to the table. is there anyway that I could arrange to have all the rows in the subform added to the table? Thanks in advance "all the rows in the subform" must come from a table or query. Use this as the source for an append query. -- Duane Hookom Microsoft Access MVP If I have helped you, please help me by donating to UCP http://www.access.hookom.net/UCP/Default.htm "ftaghabon...

simple form calculation won't calculate
I am using a simple addition calculation in Access 2007 and it will not show the result. Simple form based on a single table field 1 and field 2 with a following unbound field with the control =[filed 1] + [field 2] after tabbing through field 1 (all formatted as currency) then field 2 and tab into the following unbound field and no value shows until I press F5 and return to the record with the unbound field and then the tabulation calculation appears. I am clueless why this shouldn't calculate the result as I enter into the unbound field. Any ideas appreciated -- ****************...

"Invisible" form movable in the invisible area in Vista
I have a little clock with a color-key type of invisibility. In Windows XP, it works just fine. In Vista, I can move the form by clicking and dragging in the invisible area. It is invisible but still "there" to Vista. Here's the code I have used for years to prepare the form: Public Const InvisibleColor = 16744705 'Prepare for Invisibility Ret = GetWindowLong(Me.hwnd, GWL_EXSTYLE) Ret = Ret Or WS_EX_LAYERED SetWindowLong Me.hwnd, GWL_EXSTYLE, Ret 'Set the opacity of the layered window to 128 SetLayeredWindowAttributes Me.hwnd, InvisibleC...

Form
Hi: Can you please tell me if there is any easy way to display within a form, a progress bar? I have a report with selection criteria from a form; when more that one org units are selected it takes a while to run; just to be 'nice' during this time, idealy a form pops up to show a blue bar with the progress. If it is too complicated... I will not do it. Thanks in advance! Dan D wrote: > Hi: > > Can you please tell me if there is any easy way to display within a > form, a progress bar? > > I have a report with selection criteria from a form; when more that &...

"Main script: microsoft entourage got an error"
Version: 2008 Operating System: Mac OS X 10.6 (Snow Leopard) Processor: Intel Hi <br><br>My database was corrupted and I have successfully rebuilt it. However, whenever I start entourage, i get an error as follows: <br><br>&quot;Main script: Microsoft Entourage got an error: Can't set enabled of scheduled &quot;Check Date&quot; to false. - 10006&quot; <br><br>I have searched the web and have come up with nothing. Actions taken so far have been: <br> 1) rebuilt the database (again) <br> 2) deleted all the email accounts,...