How to set up a "Go to" menu with an Access combo or List menu?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

In Access. how do you select from a group of records from a list and
automatically go to another screen with options to apply something to that
group of records?

Currently, I'm loading a bunch of command buttons on screens to go to the
forms and then loading a bunch of command buttons to act on those selected
records.

I'm sure there is a better way...

Thanks!
 
Heidelberg,

It would be a lot easier to help you if you could be a bit more
specific. In particular, I am not sure of the meaning of "group of
records" or "another screen" or "options" or "apply something" or
"loading a bunch". Can you please give some detailed examples of what
you are trying to do? Thanks.
 
Steve Schapel said:
Heidelberg,

It would be a lot easier to help you if you could be a bit more
specific. In particular, I am not sure of the meaning of "group of
records" or "another screen" or "options" or "apply something" or
"loading a bunch". Can you please give some detailed examples of what
you are trying to do? Thanks.
Sorry, Steve!

I'm using MS Access 2000. I know how to use the combo and list boxes to
view and edit records, but how do you use them to select a form.

Thanks!
 
I'm using MS Access 2000. I know how to use the combo and list boxes to
view and edit records, but how do you use them to select a form.

I often use a listbox, or a combo box to "display" a list of forms. The
advantage of this system is less code, and each time
I add a new form (or report), then you simply add to the list, and don't
have to create a new button.

Here is some screen shots...and if you scroll down a bit, you will see where
in this access application I used a listbox
to display a bunch of forms...(note the edit button to launch the form).

http://www.kallal.ca/ridestutorialp/editlists.htm

the list box is actually two columns....

formName formDescription

The first column is set to 0, so the user ONLY sees the text description.

the code behind the button is thus

If IsNull(Me.lstForms) = False Then

DoCmd.OpenForm me.lstForms

End If

not much code at all...


there is also some screen shots here where I used a listbox of reports..and
the exact same idea as above was
used to add new reprots and launch them..but, I don't have to add more
buttions, or modify menus when I
add a new report.

http://www.members.shaw.ca/AlbertKallal/ridesrpt/ridesrpt.html

Of course, often I will also use a menu bar to launch a form, and that does
require I add a new
entry to a menu bar........

You can see this here:

http://www.kallal.ca/ridestutorialp/drivers.htm
 
Albert D. Kallal said:
I often use a listbox, or a combo box to "display" a list of forms. The
advantage of this system is less code, and each time
I add a new form (or report), then you simply add to the list, and don't
have to create a new button.

Here is some screen shots...and if you scroll down a bit, you will see where
in this access application I used a listbox
to display a bunch of forms...(note the edit button to launch the form).

http://www.kallal.ca/ridestutorialp/editlists.htm

the list box is actually two columns....

formName formDescription

The first column is set to 0, so the user ONLY sees the text description.

the code behind the button is thus

If IsNull(Me.lstForms) = False Then

DoCmd.OpenForm me.lstForms

End If

not much code at all...


there is also some screen shots here where I used a listbox of reports..and
the exact same idea as above was
used to add new reprots and launch them..but, I don't have to add more
buttions, or modify menus when I
add a new report.

http://www.members.shaw.ca/AlbertKallal/ridesrpt/ridesrpt.html

Of course, often I will also use a menu bar to launch a form, and that does
require I add a new
entry to a menu bar........

You can see this here:

http://www.kallal.ca/ridestutorialp/drivers.htm


--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
(e-mail address removed)


Albert,

Thank you for sharing these examples... they are exactly what I want to do.
How do I learn to use a list box to select a form like you did?

I'm now using the Access Switchboard menu (limited to 8 lines per screen)
and a bunch of command buttons to go to my forms...

Thanks, again! I's really impressed by your application, expecially the tab
menus.
 
Thank you for sharing these examples... they are exactly what I want to
do.
How do I learn to use a list box to select a form like you did?

Hum, I gave quite a detailed explain in my post. If you need more then what
that post explains, then you likely need to starting reading up on
ms-access. If you don't know how to create a listbox, then obviously you
will not be able to
understand the instructions I give. This is not hard, but if creating a
listbox is new for you, then you have to just try it, or perhaps you
might grab a book on ms-access.

The skills we need here are

create a table (we need to create a table with two columns)
create a form (we need to create a form to place the listbox
on)
create a listbox (we need to create a listbox based on the above
table)

It is quite easy to create a listbox after you made the table, and entered
some records. You can use the wizard to create the listbox, and use the
table as the data source for the listbox. You are going to base that listbox
on a table that you create with two columns.

To quote my previous post:
<quote>
the list box is actually two columns....

formName formDescription

The first column length (in the listbox) is set to 0, so the user ONLY sees
the text description.

</quote>

So, in the above we have two fields in a table. We now simply enter the list
of forms (and a nice description for the user to see) into this table.

So, after we enter a few records into that table, it would look like

formName formDescription

frmCust Edit the customer list
frmInvoice Edit and display a invoice
frmReprots Display Reports

So, you build a table with the above two columns. You then enter the list of
forms you want to be able to display on that listbox.
You then place this listbox on a form (use the wizard to do this).

so, on our form, the listbox will only display the 2nd column (if for some
reason you think that users need to know (or see) the form names, then by
all means display both columns in the listbox...this decison is up to
you...).

You then use the code I already posted. That code was

If IsNull(Me.lstForms) = False Then

DoCmd.OpenForm me.lstForms

End If

That is all there is here. The above assumes you called your listbox control
lstForms

You can also display forms in a continues sub-form, but in most cases this
is not needed. I explain the difference between continues sub-forms, and
listbox here

http://www.members.shaw.ca/AlbertKallal/Articles/Grid.htm
 
Albert D. Kallal said:
Hum, I gave quite a detailed explain in my post. If you need more then what
that post explains, then you likely need to starting reading up on
ms-access. If you don't know how to create a listbox, then obviously you
will not be able to
understand the instructions I give. This is not hard, but if creating a
listbox is new for you, then you have to just try it, or perhaps you
might grab a book on ms-access.

The skills we need here are

create a table (we need to create a table with two columns)
create a form (we need to create a form to place the listbox
on)
create a listbox (we need to create a listbox based on the above
table)

It is quite easy to create a listbox after you made the table, and entered
some records. You can use the wizard to create the listbox, and use the
table as the data source for the listbox. You are going to base that listbox
on a table that you create with two columns.

To quote my previous post:
<quote>
the list box is actually two columns....

formName formDescription

The first column length (in the listbox) is set to 0, so the user ONLY sees
the text description.

</quote>

So, in the above we have two fields in a table. We now simply enter the list
of forms (and a nice description for the user to see) into this table.

So, after we enter a few records into that table, it would look like

formName formDescription

frmCust Edit the customer list
frmInvoice Edit and display a invoice
frmReprots Display Reports

So, you build a table with the above two columns. You then enter the list of
forms you want to be able to display on that listbox.
You then place this listbox on a form (use the wizard to do this).

so, on our form, the listbox will only display the 2nd column (if for some
reason you think that users need to know (or see) the form names, then by
all means display both columns in the listbox...this decison is up to
you...).

You then use the code I already posted. That code was

If IsNull(Me.lstForms) = False Then

DoCmd.OpenForm me.lstForms

End If

That is all there is here. The above assumes you called your listbox control
lstForms

You can also display forms in a continues sub-form, but in most cases this
is not needed. I explain the difference between continues sub-forms, and
listbox here

http://www.members.shaw.ca/AlbertKallal/Articles/Grid.htm

--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
(e-mail address removed)

Bingo, I got it!! You're not only a great developer, but you're also a great teacher if you got me to learn how to do it. Thanks!

I used the following code under the button...

Private Sub List2_Click()
If IsNull(Me.List2) = False Then

DoCmd.OpenForm Me.List2

End If


End Sub

It works great, the only problem is that on exit from the List2 form it
writes the last choice in the listbox to the first column of the first column
of the first choice in the table. So, the first field of the first record in
the table is changed, afterwards. Did I do something wrong? Can I stop it
from writing to the first field in the table when I exit the form? Or will it
make no difference when I actually apply it to a working page.
 
It works great

Good on your part...glad to see you jumped right into the pond!!

the only problem is that on exit from the List2 form it
writes the last choice in the listbox to the first column of the first
column
of the first choice in the table.

The above is because your form is bound. By "bound" it means that the form
is attached to a table. Further, it also means that your listbox is bound
to a field.

So, in access when you hear people say that my form is un-bound, they simply
mean that the form is not attached to (or based on) a table (or query).

We don't need a bound form to just select something from a table. this means
you can un-bind the form.

Bring up a form in design mode. Make sure you select the form
(to select the form in design mode go edit->select form)

Now bring up the properties sheet
(view->properties)

Now, click on the data tab.
The first entry is called Recordsouce, and this sets the table that the form
is BOUND to. It is very likely, and very common to build forms that just
prompt the user for things, but don't actually edit data (I don't know if
this is your case.). For example, all of the forms in the "report" screen
shots shown here are un-bound

http://www.members.shaw.ca/AlbertKallal/ridesrpt/ridesrpt.html

In addition to what we call a un-bound form, we also have what is called
un-bound controls. So, it is possible that your report prompt screen is
going to be attached to a table for editing of some data, but not likely.
However, you listbox control MOST CERTAINLY needs to be un-bound. Remember,
a lsitbox, or a combo box can be placed on a form that edits data, and the
value you select from the listbox (or combo box) can be "saved" into a field
of the forms bound data. We don't need to save this selection, so, remove
the field that the listbox is bound to.

Simply bring up the form in design mode, click on the listbox, and view the
properties sheet. On the data tab, simply remove the field name in the
"control source".

By the way, when you use the wizard to build a listbox, the last two options
are

- Remember that value for
later use (un-bound - don't save selection)

- Store that value in
this field (bound - save selection into a field in table)

So, when using the wizard, you can build a un-bound listbox (and, the form
may, or may not still be bound to a table). So, you have the concept of
un-bound that applies to a form, or a control. In your case, we are 100%
sure we want the list box to be un-bound. As for if the form needs to be
un-bound...I can't know, or read your mind (but, the form being bound, or
un-bound is up to your needs).

This reprot prompt screen could work with both the form being un-bound, and
the listbox being un-bound. note that a list box can receive the data from a
table, but as long as your don't set the "contorl source" of the listbox, it
is considerd un-bound
 
Albert D. Kallal said:
Good on your part...glad to see you jumped right into the pond!!



The above is because your form is bound. By "bound" it means that the form
is attached to a table. Further, it also means that your listbox is bound
to a field.

So, in access when you hear people say that my form is un-bound, they simply
mean that the form is not attached to (or based on) a table (or query).

We don't need a bound form to just select something from a table. this means
you can un-bind the form.

Bring up a form in design mode. Make sure you select the form
(to select the form in design mode go edit->select form)

Now bring up the properties sheet
(view->properties)

Now, click on the data tab.
The first entry is called Recordsouce, and this sets the table that the form
is BOUND to. It is very likely, and very common to build forms that just
prompt the user for things, but don't actually edit data (I don't know if
this is your case.). For example, all of the forms in the "report" screen
shots shown here are un-bound

http://www.members.shaw.ca/AlbertKallal/ridesrpt/ridesrpt.html

In addition to what we call a un-bound form, we also have what is called
un-bound controls. So, it is possible that your report prompt screen is
going to be attached to a table for editing of some data, but not likely.
However, you listbox control MOST CERTAINLY needs to be un-bound. Remember,
a lsitbox, or a combo box can be placed on a form that edits data, and the
value you select from the listbox (or combo box) can be "saved" into a field
of the forms bound data. We don't need to save this selection, so, remove
the field that the listbox is bound to.

Simply bring up the form in design mode, click on the listbox, and view the
properties sheet. On the data tab, simply remove the field name in the
"control source".

By the way, when you use the wizard to build a listbox, the last two options
are

- Remember that value for
later use (un-bound - don't save selection)

- Store that value in
this field (bound - save selection into a field in table)

So, when using the wizard, you can build a un-bound listbox (and, the form
may, or may not still be bound to a table). So, you have the concept of
un-bound that applies to a form, or a control. In your case, we are 100%
sure we want the list box to be un-bound. As for if the form needs to be
un-bound...I can't know, or read your mind (but, the form being bound, or
un-bound is up to your needs).

This reprot prompt screen could work with both the form being un-bound, and
the listbox being un-bound. note that a list box can receive the data from a
table, but as long as your don't set the "contorl source" of the listbox, it
is considerd un-bound

--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
(e-mail address removed)


Got it!

I now have an un-bound form and an un-bound listbox, and it works great!

Now that I'm an expert in Listboxes, I'm ready for the "How to's" to learn
your menu bar technique...

By the way the photos your took for your Rider program screens are excellent
choices!
 
Albert D. Kallal said:
I don't have a how to on menus just yet..but, I do like them, and explain
their use here:
http://www.members.shaw.ca/AlbertKallal/Articles/UseAbility/UserFriendly.htm

--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
(e-mail address removed)

Thanks, Albert! If you ever get to publishing a "How to" of the Menu Bar technique, I would love to get a copy of it.

Thanks again for all of you help! I've already used the Listbox technique
on my programs. It eliminated many Command Buttons and it sure makes adding
program choices easier.

Regards!

Heidelberg
 
Back
Top