Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 318
  • Last Modified:

Referencing controls on a 2010 Navigation Form

I have an old .mdb that I am attempting to upgrade.  I have imported all of what I feel are the necessary tables, queries, forms, reports, and modules into a new .accdb database.  I have also incorporated several of the forms into a Navigational Form (frmNavigation; verticle tabs left style).  One of the forms ([Report Dates Entry Form] has vba code attached to a command button that needs to set the value of a date variable to the value of another control ([EndDate]) on the form.  In the old line of code this was accomplished by :

dteWeekEnd = Forms![Report Dates Entry Form]![EndDate].Value

After doing some reading I thought the that once the form was placed in the Navigation Form (attached to NavigationButton9) that the proper syntax would be:

dteWeekEnd = Forms![frmNavigation]![NavigationButton9].[Form]![EndDate].Value

But now I get an error stating "Object doesn't support this property or method
What am I doing wrong?
0
cekendricks
Asked:
cekendricks
  • 3
  • 2
1 Solution
 
Rey Obrero (Capricorn1)Commented:
try

dteWeekEnd = Forms![frmNavigation]![Report Dates Entry Form].[Form]![EndDate].Value
0
 
Rey Obrero (Capricorn1)Commented:

dteWeekEnd = Forms![frmNavigation]![Report Dates Entry Form].[Form]![EndDate].Value
-------------------------------------------------^^^^^^^^^^^^^^^^  use the subform control name
0
 
cekendricksAuthor Commented:
When I tried the first suggestion I get an error stating that "Access can't find the field 'Report Dates Entry Form'"

I don't understand the second statement....do you mean the control on the Navigation Form?  NavigationButton9 ?

I've already tried:
dteWeekEnd = Forms![frmNavigation]![NavigationButton9].[Form]![EndDate].Value

which didn't work either...I don't really think I understand which control you're referring to by 'Subform control name'
0
 
Rey Obrero (Capricorn1)Commented:
open the form in design view,  and click on the outer edge of the subform and open the property sheet
click on the ALL tab

see the image
subformControlname.jpg
0
 
cekendricksAuthor Commented:
Top Notch, and extremely timely assistance !
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now