473,441 Members | 1,993 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,441 software developers and data experts.

combo that looks up forms to load

daniel aristidou
491 256MB
Hi i have created all my forms for my database and every thing runs smooth but i would like to have a login form where i can have a combo box that scrolls down showing an option of forms. the thing is i would like it to show only specific forms... or have a nother master combo box which cascade updates the other to select the forms related to that topic. i have seen this before where u click on a command button and it loads the form that is selected in the combo box. thanks in advance for the help.!
p.s Im not very familiar with visual basic code but should be ok providing someone runs through the steps fully with me. thanks again in advance for helping.
Sep 5 '07 #1
5 1163
Rabbit
12,516 Expert Mod 8TB
Hi i have created all my forms for my database and every thing runs smooth but i would like to have a login form where i can have a combo box that scrolls down showing an option of forms. the thing is i would like it to show only specific forms... or have a nother master combo box which cascade updates the other to select the forms related to that topic. i have seen this before where u click on a command button and it loads the form that is selected in the combo box. thanks in advance for the help.!
p.s Im not very familiar with visual basic code but should be ok providing someone runs through the steps fully with me. thanks again in advance for helping.
This tutorial will help you set up the combo boxes.

As for opening the form, you can use DoCmd.OpenForm cbo_FormName
Sep 5 '07 #2
Jim Doherty
897 Expert 512MB
Hi i have created all my forms for my database and every thing runs smooth but i would like to have a login form where i can have a combo box that scrolls down showing an option of forms. the thing is i would like it to show only specific forms... or have a nother master combo box which cascade updates the other to select the forms related to that topic. i have seen this before where u click on a command button and it loads the form that is selected in the combo box. thanks in advance for the help.!
p.s Im not very familiar with visual basic code but should be ok providing someone runs through the steps fully with me. thanks again in advance for helping.
The easiest method for you to keep a handle on this is to insert into a table of your own a list of your database forms sitting 'independant' of Access's own method for storing its objects.

You can then assign control elements by creating extra fields in that table where you can then control and store what 'does' and 'does not' happen for instance a field might be called SHOW as a simple Yes/No field tickbox shall we say. You would then base your listing of forms in any dropdown on the contents of this table where Show=True or Show =False.

You are going to have flexibility on this because you can add extra fields to your table to add extra controlling or restrictive elements that you might seek and call back this list in an SQL statement using relevant criteria

ie: "SELECT NameOfForm FROM tblMyListOfForms WHERE Show=TRUE"

and for a listbox as in your case you might want to set the rowsource in much the same way

Depending on your version of Access below is an SQL statement that will retrieve for you a List of Access forms from its MsysObjects table. If you use this in the query Window like So...

Expand|Select|Wrap|Line Numbers
  1. SELECT MSysObjects.Name AS NameOfForm INTO tblMyListOfFormNames
  2. FROM MSysObjects
  3. WHERE (((MSysObjects.Type)=-32768))
  4. ORDER BY MSysObjects.Name;
You will have 'automatically created' for you an independant table as mentioned visible in the Access window that you can work with easier than having to potentially hardcode everything. The only downside to this technique is that you have te remember.... it is an independant table as such so if you create another form it will not obviously be in the table automatically. (Unless of course you find that the technique works so well in your circumstances that you are happy to employ simple methods keep this table updated and synchronised to the current objects in the database. (which you could raise as another thread if you have problems but I suspect you won't) It is a matter for you.

In terms of your extra requirement ie: the interdependant combo boxes this is a regular feature raised often and quite easily sorted out. I'd go with trying out the above firstly and then return when you need to determine your datavalues of one combo based on another. you will get answers on this quite easily in my absence from others. unless I pick up the thread again when I will be happy to assist you.

Hope this helps

Jim
Sep 5 '07 #3
daniel aristidou
491 256MB
Hi guys You have both been Great help !!!!! Superb work thanks alot , i found the easiest way was to create multiple tables and combo boxes(a combo box for each tbl) instead of using cascade updating boxes. You have been great help, and i hope anyone else with the same problem will look here and figure it out as easily as i did with the information you provided me with.~!!!!
Sep 5 '07 #4
Rabbit
12,516 Expert Mod 8TB
Good Luck.
Sep 5 '07 #5
Denburt
1,356 Expert 1GB
This one may be a bit more complicated but I use this to show certain sub-reports in a listbox I can then choose which sub-reports I want to show. It is very similar to what you were describing. Simply paste the following in a module and in the rowsourcetype of the combobox enter "GetForms" I don't even use the rowsource. I use the first three letters SHW to show the ones I want to see in the listbox.


Expand|Select|Wrap|Line Numbers
  1. Function GetForms(Fld As Control, id As Variant, row As Variant, col As Variant, Code As Variant) As Variant
  2.   Static dbs() As String, Entries As Integer
  3.   Dim ReturnVal As Variant
  4.   Dim con As Container
  5.   Dim db As Database
  6.   Dim doc As Document
  7.   Dim m
  8.   Set db = CurrentDb
  9.     ReturnVal = Null
  10.     Select Case Code
  11.         Case acLBInitialize
  12.             Entries = 0
  13.   Set con = db.Containers("Forms")
  14. redim preserve dbs(con.Documents.count)
  15.     For Each doc In con.Documents
  16.         If Left(doc.Name, 3) = "SHW" Then
  17.                 dbs(Entries) = Right(doc.Name, Len(doc.Name) - 3) 
  18.         End If
  19.             Entries = Entries + 1
  20.         End If
  21.     Next doc
  22.                 ReturnVal = Entries
  23.         Case acLBOpen
  24.             ReturnVal = Timer
  25.         Case acLBGetRowCount
  26.             ReturnVal = Entries
  27.         Case acLBGetColumnCount
  28.             ReturnVal = 1
  29.         Case acLBGetColumnWidth
  30.             ReturnVal = -1
  31.         Case acLBGetValue
  32.             ReturnVal = dbs(row)
  33. Case acLBEnd
  34.             Erase dbs
  35.     End Select
  36.     GetForms = ReturnVal
  37.     End Function
  38.  
Sep 5 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Heather | last post by:
Hi I am desparately looking for advice in relation to storing the results after selecting items from two combo boxes on a Referral form. The first combo box 'ctl Type' displays a full list of...
2
by: Lucinda Roebuck | last post by:
I'm using Access 97 on a Windows XP computer. The combo box on the form "form1" will not refresh after a new name is added to the list. The "limit to list" properties for the combo box is set to...
7
by: Doug | last post by:
Hi I have a combo box (A) that populates a following combo box (B) based on a selection. The selection from the first combo box (A) initiates an OleDbDataAdapter routine that extracts the...
1
by: KevinW | last post by:
Imports System.Data.OleDb Imports System Imports System.Data Imports System.Data.Common Imports System.Windows.Forms Public Class Form1 Inherits System.Windows.Forms.Form I am trying to...
9
by: Edwinah63 | last post by:
Hi everyone, Please let there be someone out there who can help. I have two BOUND combo boxes on a continuous form, the second being dependent on the first. I have no problem getting the...
0
by: Tom | last post by:
I have some very strange issues with combo boxes on a tab control. Here's the scenario: I have a Windows Forms form that has a tab control on it, with two (2) tabs. Tab 2 happens to have a number...
2
by: Ausclad | last post by:
Hi, I have a combo box that I want to populate, based on the selection of another combo box. So when combo box A is selected, combo box B is populated with related values. I have this all...
8
by: ShyGuy | last post by:
I have two combo boxes that get their values from two different tables. I want to limit the choices in the second combo box by what is selected in the first. I tried using SelText (code...
6
by: fieldja | last post by:
I have a form called OwnerForm. It contains a combo box called Owner. The combo box looks up names from a table called OwnerName. It contains fields called OwnerID and Owner. I also have a main...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.