Form maken

Status
Niet open voor verdere reacties.

capkin

Gebruiker
Lid geworden
29 mrt 2005
Berichten
7
Mensen ik heb een vraag ik probeer een formulier te maken waar bij drie dropdown menus komen en als je op bovenste dropdown menu klikt moet de tweede en de derde dropdown menu moet automatisch ingevuld worden.

zie foto voor hoe er uit ziet

vb.jpg



Wat ik wil weten is of het mogelijk is als ik Bij Platform een cisco kies dat het Category bij cisco hoort en Metric bij cisco automatich opgehaald wordt en die gegevens staan in andere tabellen

En vervolgens dat Metric Type, Metric Description, Method en Enmation gevuld wordt.

Voor duidelijkhied zij er volgende tabellen en relatie tussen tabbellen ziet er zo uit:

relatie.jpg
 
Mischien heb je hier wat aan:

Referring to Columns in a Combo Box (015)

First, some background. What follows is a standard use of a combo box on an Order Form form..

Table A - Customers
- customer ID
- customer name
- customer address
- etc, etc

Table B - Orders
- order ID
- customer ID
- order date
- etc, etc


There is, of course, a one-to-many relationship from the Customers table to the Orders table.

To choose the correct customer for the order, on the Orders form we put a combo box bound to the customer ID in the Orders table. The row source for the combo box, though, comes from the Customers table. Here are some typical properties for the combo box.

Name: cboCustomer
Control Source: CustomerID
Row Source
SELECT [Customers].CustomerID, [Customers].CustomerName FROM [Customers] ORDER BY [Customers].CustomerID;

Column Count 2
Column Widths 0";2"
Bound Column 1

Remember, the combo box is bound to the CustomerID in the Orders table. That is a big key to having this work.

Now, when the person doing the data entry clicks the drop down of the combo box, they will see the customer names, but not their codes. If you want to see the codes, change the column widths to 0.5"; 2" or similar. Also, a benefit of combo boxes is that if you know the customer's correct name, just start typing and it will auto expand to show the whole name. This is a keyboard alternative to using the drop down.

Back to the original topic of this tip. If you have read tip001 then you know that you can use the value in this combo box as a parameter in a query. Since the query normally uses the CustomerID to do the criteria, we use [Forms]![frmOrders]![cboCustomer] to get the data for the chosen customer. The value passed back is the Bound Column, listed as 1 (first column) in the properties. This is the CustomerID.

What if you want to refer to the customer's name? Then, use this style.
[Forms]![frmOrders]![cboCustomer].column(1)

Whoa. Hey Manxman, I thought we determined that the first column is the CustomerID! I want the name this time.

Well, that's correct. When you use .column(n), Access starts with (0). So the CustomerID is the bound column, which in the properties box is "1". But Access considers that .column(0), and therefore, the CustomerName is the 2nd column, or, .column(1).

I know, clear as mud.

This is a typical use of a combo box. You will have many of these basic one-to-many relationships in your use of Access, and each one lends itself nicely to this method.

Bij mij werkte het, moet alleen een button toevoegen om de form data te resetten. Als je nu voor custumerID Cisco invult komt dit ook in je overall table terecht.

Succes.
 
het

het is mij gedeeltelijk gelukt maar niet helemaal ik zit hier vast

als ik deze frm maak:
Foto=TH4OLWZR


met deze relationship:
Foto=GA6KCF8T


ComboBox4 Platform
Row Source: SELECT [platform].[pl_id], [platform].[pl_name], [platform].[pl_description] FROM platform;

After Update [Event Procedure]
Private Sub Combo4_AfterUpdate()
Me.Combo0.Value = Null
Me.Combo0.Requery
End Sub






ComboBox0 Category
Row Source: SELECT ??????????

After Update [Event Procedure]
Private Sub Combo0_AfterUpdate()
Me.Combo2.Value = Null
Me.Combo2.Requery
End Sub






ComboBox2 Metric
Row Source: SELECT [metrictype].[mt_name], [metrictype].[ca_id], [metrictype].[mt_id] FROM metrictype WHERE ((([metrictype].[ca_id])=[Forms]![frm_platform]![Combo0]));



mij vraag is of iemand weet wat ik bij Row Source: SELECT moet in vullen bij ComboBox0 Category wel volgens deze relationship:
Foto=GA6KCF8T


thnx
 
Laatst bewerkt:
ik wil gaan filteren met behulp van relationele tabellen.
Mijn relationele tabellen:
Foto=GA6KCF8T

Zoals het voorbeeld , wil ik het zo:
Foto=TH4OLWZR

Selectievak 1: Je selecteert hier een platform
Selectievak 2: Je selecteert hier alle category van dat platform (filter is selectievak 1)
Seklectievak 3: Je selecteert hier alle metrictype van dat category (filter is selectievak 2)

Mvg
Capkin
 
Dat doe je zo

Dit werkt alleen maar als het platform Id is opgenomen in de tabel Category en als de CategoryId is opgenomen in de tabel Metric. Gezien je vraagstelling zal dit wel zo zijn. Je zult in je formulier enkele (verborgen) velden moeten maken waarin je met Dlookup de ID ophaalt die je gebruikt als criteria in de querie voor het volgende veld. Over DLookup is nogal wat geschreven op deze pagina.
Dat ziet er dan op je form zo uit. Na selectie [platform] moet mbv Dlookup het bijbehorende Id worden opgehaald. Ik noem dit veldje maar even FmPlatformId. In de volgende querie die je gebruikt in het veld category vermeld je als criteria bij platformId: Forms![naam formuliertje]![FmPlatformId]. In het keuzelijstje zul je dan alleen maar records zien die hetzelfde platformId hebben als door jou geselecteerd. Ditzelfde doe je voor het laatste veldje.

Nu moet je nog bij eigenschappen van het veld [platform] bij na bijwerken het veld [category] een requerie geven. Als je dan even een ander platform selecteert laat de querie de bijbehorende records uit category zien. Deze requerie moet je ook op een zelfde manier inbouwen in het veld category.

Je kunt het jezelf makkelijker maken door ipv PlatformId op te nemen in je tabel Category je de naam van het platform in deze tabel zet. Alle velden met Dlookup kun je dan vergeten. Dan kun je bij criteria in je querie rechtstreeks verwijzen naar het veld [platform] in je formulier.

Over dit onderwerp zijn op deze site overigens al veel antwoorden gegeven. Zoek maar eens op "keuzelijst".

Suc7
 
Laatst bewerkt:
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan