Newb question: How did my Form_.... Access Class Objects get crea

  • Thread starter Thread starter PatK
  • Start date Start date
P

PatK

I have an access database that originally was created in office 2003 access.
I am not in 2007 Access. When I go into the IDE, I can see, under Microsoft
Office Access Class Objects, a set of what appears to be modules named:
- Form_form abc
- Form_form xyz
etc

Each of these corresponds to an actual form I have created, and includes
subroutines like

Private Sub RefreshAssetTable()
ImportExcel
End Sub

Private Sub Command4_Click()
ImportExcelAssets
End Sub

by default. Now, my question: How did this class "modules" (and I know
that is the wrong term) get created? I "thought" it was a function of my
having created the form back in 2003. I then inserted code on various event
subroutines with these class modules.

Now I am in 2007 however, and these do not seem to be created when I create
a new form.

Have I gone insane? I know I created the old DB and forms a year or so ago,
but I do not remember doing anything "special" to create these classes.

Thanks for any insights...I "think" i need some new ones, linked to new
forms I am creating, but for the life of me, cannot seem to figure out how to
make them.

Thanks!

patk
 
Yes, each form has a module behind it. (They are actually class modules.)

You need the modules if they contain code for the event procedures, e.g. if
you have a command button with a Click event procedure.

If the modules are blank (or contain only the Option statement(s) at the
top), you don't need them. You can remove them by setting the form's
HasModule property to No. Access will ask you to confirm that you want to
get rid of the module. After compacting the database, they are gone.

However, your example suggests that you do have some code in these modules.
If you remove the code, the functionality will be gone. Your example shows a
button(?) named Command4, with a Click event procedure. If you remove the
form's module, nothing will happen when you click the button.

In Access 2007, it will automatically create the module for you as soon as
you set any of the Event properties to:
[Event Procedure]
 
That did the trick. What I was trying to do was get a form created, that was
not bound by any table, but to be able to execute code, based upon choices a
user might take. And I needed an "on open" type of subroutine to populate
some listboxes, etc (which I have yet to figure out how to do, but I shall
persevere).

Thanks, Allen! (again!)

Patk

Allen Browne said:
Yes, each form has a module behind it. (They are actually class modules.)

You need the modules if they contain code for the event procedures, e.g. if
you have a command button with a Click event procedure.

If the modules are blank (or contain only the Option statement(s) at the
top), you don't need them. You can remove them by setting the form's
HasModule property to No. Access will ask you to confirm that you want to
get rid of the module. After compacting the database, they are gone.

However, your example suggests that you do have some code in these modules.
If you remove the code, the functionality will be gone. Your example shows a
button(?) named Command4, with a Click event procedure. If you remove the
form's module, nothing will happen when you click the button.

In Access 2007, it will automatically create the module for you as soon as
you set any of the Event properties to:
[Event Procedure]

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

PatK said:
I have an access database that originally was created in office 2003
access.
I am not in 2007 Access. When I go into the IDE, I can see, under
Microsoft
Office Access Class Objects, a set of what appears to be modules named:
- Form_form abc
- Form_form xyz
etc

Each of these corresponds to an actual form I have created, and includes
subroutines like

Private Sub RefreshAssetTable()
ImportExcel
End Sub

Private Sub Command4_Click()
ImportExcelAssets
End Sub

by default. Now, my question: How did this class "modules" (and I know
that is the wrong term) get created? I "thought" it was a function of my
having created the form back in 2003. I then inserted code on various
event
subroutines with these class modules.

Now I am in 2007 however, and these do not seem to be created when I
create
a new form.

Have I gone insane? I know I created the old DB and forms a year or so
ago,
but I do not remember doing anything "special" to create these classes.

Thanks for any insights...I "think" i need some new ones, linked to new
forms I am creating, but for the life of me, cannot seem to figure out how
to
make them.

Thanks!

patk
 
Well...no joy. I created a new form (blank), unbound. I then added a
listbox. I place and "on open" event on the form itself. However, there is
still no class module in the IDE that I can see, and thus, I cannot provide
the code associated with the events (like a listbox choice by the user).

Note that my "source" of data for the listbox is a function =populatelist()
so still need to figure out how to get something like that to work, but I am
more concerned that I have no place for the code at all.

Any suggestions would be greatly appreciated. Not sure where I am going
wrong.

Patk

PatK said:
That did the trick. What I was trying to do was get a form created, that was
not bound by any table, but to be able to execute code, based upon choices a
user might take. And I needed an "on open" type of subroutine to populate
some listboxes, etc (which I have yet to figure out how to do, but I shall
persevere).

Thanks, Allen! (again!)

Patk

Allen Browne said:
Yes, each form has a module behind it. (They are actually class modules.)

You need the modules if they contain code for the event procedures, e.g. if
you have a command button with a Click event procedure.

If the modules are blank (or contain only the Option statement(s) at the
top), you don't need them. You can remove them by setting the form's
HasModule property to No. Access will ask you to confirm that you want to
get rid of the module. After compacting the database, they are gone.

However, your example suggests that you do have some code in these modules.
If you remove the code, the functionality will be gone. Your example shows a
button(?) named Command4, with a Click event procedure. If you remove the
form's module, nothing will happen when you click the button.

In Access 2007, it will automatically create the module for you as soon as
you set any of the Event properties to:
[Event Procedure]

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

PatK said:
I have an access database that originally was created in office 2003
access.
I am not in 2007 Access. When I go into the IDE, I can see, under
Microsoft
Office Access Class Objects, a set of what appears to be modules named:
- Form_form abc
- Form_form xyz
etc

Each of these corresponds to an actual form I have created, and includes
subroutines like

Private Sub RefreshAssetTable()
ImportExcel
End Sub

Private Sub Command4_Click()
ImportExcelAssets
End Sub

by default. Now, my question: How did this class "modules" (and I know
that is the wrong term) get created? I "thought" it was a function of my
having created the form back in 2003. I then inserted code on various
event
subroutines with these class modules.

Now I am in 2007 however, and these do not seem to be created when I
create
a new form.

Have I gone insane? I know I created the old DB and forms a year or so
ago,
but I do not remember doing anything "special" to create these classes.

Thanks for any insights...I "think" i need some new ones, linked to new
forms I am creating, but for the life of me, cannot seem to figure out how
to
make them.

Thanks!

patk
 
Perhaps I should add that I am on Access 2007 (ouch!)

PatK said:
Well...no joy. I created a new form (blank), unbound. I then added a
listbox. I place and "on open" event on the form itself. However, there is
still no class module in the IDE that I can see, and thus, I cannot provide
the code associated with the events (like a listbox choice by the user).

Note that my "source" of data for the listbox is a function =populatelist()
so still need to figure out how to get something like that to work, but I am
more concerned that I have no place for the code at all.

Any suggestions would be greatly appreciated. Not sure where I am going
wrong.

Patk

PatK said:
That did the trick. What I was trying to do was get a form created, that was
not bound by any table, but to be able to execute code, based upon choices a
user might take. And I needed an "on open" type of subroutine to populate
some listboxes, etc (which I have yet to figure out how to do, but I shall
persevere).

Thanks, Allen! (again!)

Patk

Allen Browne said:
Yes, each form has a module behind it. (They are actually class modules.)

You need the modules if they contain code for the event procedures, e.g. if
you have a command button with a Click event procedure.

If the modules are blank (or contain only the Option statement(s) at the
top), you don't need them. You can remove them by setting the form's
HasModule property to No. Access will ask you to confirm that you want to
get rid of the module. After compacting the database, they are gone.

However, your example suggests that you do have some code in these modules.
If you remove the code, the functionality will be gone. Your example shows a
button(?) named Command4, with a Click event procedure. If you remove the
form's module, nothing will happen when you click the button.

In Access 2007, it will automatically create the module for you as soon as
you set any of the Event properties to:
[Event Procedure]

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

I have an access database that originally was created in office 2003
access.
I am not in 2007 Access. When I go into the IDE, I can see, under
Microsoft
Office Access Class Objects, a set of what appears to be modules named:
- Form_form abc
- Form_form xyz
etc

Each of these corresponds to an actual form I have created, and includes
subroutines like

Private Sub RefreshAssetTable()
ImportExcel
End Sub

Private Sub Command4_Click()
ImportExcelAssets
End Sub

by default. Now, my question: How did this class "modules" (and I know
that is the wrong term) get created? I "thought" it was a function of my
having created the form back in 2003. I then inserted code on various
event
subroutines with these class modules.

Now I am in 2007 however, and these do not seem to be created when I
create
a new form.

Have I gone insane? I know I created the old DB and forms a year or so
ago,
but I do not remember doing anything "special" to create these classes.

Thanks for any insights...I "think" i need some new ones, linked to new
forms I am creating, but for the life of me, cannot seem to figure out how
to
make them.

Thanks!

patk
 
In form design view, open the Properties Sheet.

On the Event tab of the Properties sheet, while looking at the properties of
the form (not list box), set the On Open property to:
[Event Procedure]

Click the Build button (...) beside this.
Access opens the code window, so voila: there's your module.

You can also get to the form's module through the ribbon. At the very right
end of the Design ribbon, in the Tools chunk, there are 3 icons. The top one
takes you to the form's module.

A2007 is fine - as long as you have SP1.
 
YES! Thou art The Man, Allan.... :-)

Allen Browne said:
In form design view, open the Properties Sheet.

On the Event tab of the Properties sheet, while looking at the properties of
the form (not list box), set the On Open property to:
[Event Procedure]

Click the Build button (...) beside this.
Access opens the code window, so voila: there's your module.

You can also get to the form's module through the ribbon. At the very right
end of the Design ribbon, in the Tools chunk, there are 3 icons. The top one
takes you to the form's module.

A2007 is fine - as long as you have SP1.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

PatK said:
Perhaps I should add that I am on Access 2007 (ouch!)
 
Back
Top