Proper subform control naming

Martyh

Registered User.
Local time
Today, 01:25
Joined
May 2, 2000
Messages
196
Each time that I move from tab to tab I would like to make certain that the data that I have collected thus far will be maintained. thus I have developed an "Edit / View" type. The problem is that I can't seem to get the proper subform name so that I could modify the caption on a particular control within that subform.

Can anyone help !!

Here is the piece of code that I've got so far:
The event is a tab change event.

Private Sub tabProjectDetail_Change()
Dim xtxt As String

Select Case Me.TabProjectDetail
Case 0
xtxt = Me!subfrmOwner.Form '<<--- here is the problem. This is not the way to call the controls on the subform
'<<--- and I cannot figure out what it is ??

MsgBox "First page of tab " & xtxt
Case 1
MsgBox "Second page of tab"
Case 2
MsgBox "Third page of tab"
Case 3
MsgBox "Fourth page of tab"
End Select
End Sub

:o
 
I'll try.

Me
The main or parent form you're working on

!subfrmOwner
I don't know what you have on your form, of course, but, theoretically, you should now add the name of the subform control that you must access. Click on the subform control only once, then view the properties of this control. Check the 'Name' value. This is the value that goes into your code at this point. Note that the name of this subform control might have the same name as the form that is inside this subform control, but it might not. Don't confuse the two.

.Form
Now you use this term (.Form) to say, "I'm now talking about the form inside the subform control." You're "drilling down" from the subform control (subfrmOwner) to the underlying form.

!MyControl
Now add the name of the control you want and you're done. I suppose that saying .Form (above) is like saying Me! again, except you are now on a different form - a child form of the, er, parent form.

hth.
w
 
Beautiful !!

Thanks again !!

BTW How did you come about all this knowledge ?? Can you suggest a book ??


Marty
 
Last edited:
books

i use help (F1) a lot (VBA help is way more useful than Access help) and read the MSDN web site. there is some very helpful stuff in there. be sure to check the info that is available for all versions of access. a lot of info is not repeated for different versions, yet applies to all versions. of course, i've also learned a bunch on these forums.

my first significant book was Databases: Design, Development and Deployment Using Microsoft Access (Rob/Semaan). it is macro-based, which many people avoid, but i think it was a great introduction!

i've gone through the Access Bible (2000), the Access 2000 Crash Course, Access Security (Robinson) and others. The Crash Course and the Security book are for medium and advanced users and have some stuff i will probably never use and at the time i read them both were too advanced for me (just starting VBA). i'm sure the Crash Course would be more handy now that my VBA-feet are wet.

i've recently gotten into the Wrox publications, thanks to a developer i know and recommendations on this site. they really are good:
- Beginning Access 2003 VBA, oddly enough, uses an approach that is geared to (i think) more advanced developers. it should probably be called 'Beginning Access 2003 VBA for Experienced Developers'. it's very interesting (!) but not altogether practical. its focus is on creating your own classes, using ADO, n-tiered design and even gets into Access data projects using SQL Server and stored procedures.
- the bigger Access 2003 VBA Programmers Reference is more useful and is a must-have. some existing VBA knowledge would be a good idea but it has great info on everything. it is a reference book and is very useful.
- Microsoft Access Application Development (Feddema) is also very good. It's geared toward those with normalization and coding experience but it is not too complex. It works through an application that contains most of the standard business application requirements - multiple contact details/addresses/phones, etc., inventory, pricing, shipping, etc. - explained in clear detail. It also deals with working with the rest of the Office suite (Word, Excel). An excellent development book.

if you're going to get into a serious project, especially for someone else, make sure you've gone through Database Design for Mere Mortals (Hernandez). Also, Learning SQL: A Step-By-Step Guide Using Access (Bagui/Earp) is a very nice, handy reference book.

Also, search this site for threads about book suggestions.

w
 
Last edited:

Users who are viewing this thread

Back
Top Bottom