Solved

Using Forms 2.0 Frame Control on MS Access Form

Posted on 2009-05-19
2
1,670 Views
Last Modified: 2013-12-26
Please provide a VBA example of how to access and set the value of a textbox placed on an MS Forms 2.0 Frame Control within an MS Access form.

In Excel the following code displays the value of textbox1:

MsgBox Frame1.Controls("textbox1").Text

On an Access form, this does not work  

In addition:

Frame1.Controls.Count = 0

 
0
Comment
Question by:jakemdrew
2 Comments
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
ID: 24428054
You generally must reference the Object property of the control. Many find it easier to set the control to a variable, so you can use Intellisense:

Dim ctl As forms.Frame
Set ctl = Me.YourFrameControl.Object

ctl.Controls("textbox1")

I'm not sure about the "forms.frame" ... I don't use the 2.0 controls due to the instability they seem to always produce, but I'm sure you can locate the correct library.

Note you do NOT reference the .Text property of Access textboxes unless those controls have the focus. This is unlike VB, where you must reference the .Text properly.
0
 
LVL 3

Author Comment

by:jakemdrew
ID: 24428116
This worked!  Thank you!

Dim x As MSForms.Frame

Set x = Me.Frame4.Object

MsgBox x.Controls("textbox1").Value
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Launch app from Access custom ribbon 8 33
Delete QueryDef IF it Exists: Access VBA 5 36
Should I keep recordsets open? 3 24
Error with a code discussed on this page 5 16
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question