forms and list boxes

jprma

Registered User.
Local time
Today, 15:37
Joined
Dec 19, 2000
Messages
18
Hi friends, I am creating a MS ACCESS database and would like to be able to open all my forms by using a listbox. I have created a table (named TBLFORMS)in which the are stored all the names of the forms. I have then created a list box (named LSTFORMS)which reads its source from this table. This allows to display all the names of the forms.
Is there a way that I can open the selected form in the listbox by using a command button?
 
Hello,

Ther certainly is a way to open the selected form with a command button.

Create a variable that contains the current formname selected in the listbox.

Dim frmName as string
frmName = listbox.value

DoCmd.OpenForm frmname , acNormal, , , acFormEdit, acWindowNormal

Problems? Just post!

Hope this help.

Albert
 
Hello,

There certainly is a way to open the selected form with a command button.

Create a variable that contains the current formname selected in the listbox.

Dim frmName as string
frmName = listbox.value

DoCmd.OpenForm frmname , acNormal, , , acFormEdit, acWindowNormal

Problems? Just post!

Hope this help.

Albert
 
Thanks, I appreciate your help. By the way I still cannot get it working. I will try be be more clear with my explanation.
I have a table named FORMS which lists the names of my database's 10 forms. I then have a search form names frmQueries on which I have added a TAB CONTROL. On a page named UTILITIES of this TAB CONTROL I have added a list box named LSTFORMS which display the data in the table named FORMS.
I am trying to open the appropriate form selected in this list box, by using a command button (or perhaps by just pressing ENTER). Maybe I am asking something to big for me. I would appricate your further help.
THanks
 
Hello,

On the UTILITIES page, add a command button.

Behind the command button on the 'On click' event, (tab 'events' in the properties of the command button)type the following:

Dim formname as string
formname = LSTFORMS.value

DoCmd.OpenForm formname, acNormal, , , acFormEdit, acWindowNormal

NOTE: The names of the form in the listbox must be exactly the same as the name of the forms! Also spaces!

If you want the code to be fired when you press enter, put this code after the 'On key down' event. Let code find out if the enter is pressed.

I tried this in my db, and it works great. If it still isn't working send the db to me. I will have a look and try to fix the problem. (97 or 2000 format)

greetings,

Albert
 

Users who are viewing this thread

Back
Top Bottom