Toon posts:

[ACCESS 2003] Producten soorteren

Pagina: 1
Acties:
  • 36 views sinds 30-01-2008

Verwijderd

Topicstarter
Ik wil een formulier maken met wat gegevens van de producten. Men moet in deze formulier, in een aantal combovakjes kunnen de gegevens filteren (zie bijlage). En het rusultaat moet met behulp van een subformulier gegeven worden.
Ik kom vast te zitten bij mijn 4de keuzelijst.

Klik

Ik maak gebruik van Microsoft Access 2003.


edit: voor de mensen die geen access hebben. Ik heb dus 6 keuzelijst... mijn vb die ik geschreven heb is

code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
 Option Compare Database


Private Sub cboSoort_AfterUpdate()
     
     Dim strSQL As String
     Dim strSQLSF As String
          
     cboType = Null
     cboMerk = Null
     cboModel = Null
     cboModelSoort = Null
     
     
         
     strSQL = "SELECT DISTINCT tblProduct.Type FROM tblProduct "
     strSQL = strSQL & " WHERE tblProduct.Soort = '" & cboSoort & "'"
     strSQL = strSQL & " ORDER BY tblProduct.Type;"
     
     cboType.RowSource = strSQL
               
     strSQLSF = "SELECT * FROM tblProduct "
     strSQLSF = strSQLSF & " WHERE tblProduct.Soort = '" & cboSoort & "'"
          
     Me!sfrmProduct.LinkChildFields = "Soort"
     Me!sfrmProduct.LinkMasterFields = "Soort"
     Me.RecordSource = strSQLSF
     Me.Requery


End Sub

Private Sub cboType_AfterUpdate()
     Dim strSQL As String
     Dim strSQLSF As String
        
   
     cboMerk = Null
     cboModel = Null
     cboModelSoort = Null
     
    strSQL = " SELECT DISTINCT tblProduct.Merk FROM tblProduct "
    strSQL = strSQL & " WHERE tblProduct.Soort = '" & cboSoort & "' And  "
    strSQL = strSQL & " tblProduct.Type = '" & cboType & "'"
    strSQL = strSQL & " ORDER BY tblProduct.Merk;"
    
    cboMerk.RowSource = strSQL
    
    strSQLSF = " SELECT * FROM tblProduct "
    strSQLSF = strSQLSF & " WHERE tblProduct.Soort = '" & cboSoort & "' And  "
    strSQLSF = strSQLSF & " tblProduct.Type = '" & cboType & "'"
          
    
    Me!sfrmProduct.LinkChildFields = ""
    Me!sfrmProduct.LinkMasterFields = ""
     
    Me!sfrmProduct.LinkChildFields = "Soort;Type"
    Me!sfrmProduct.LinkMasterFields = "Soort;Type"
    Me.RecordSource = strSQLSF
    Me.Requery

End Sub

Private Sub cboMerk_AfterUpdate()

     Dim strSQL As String
     Dim strSQLSF As String
    
    cboModelSoort = Null
    cboModel = Null
    
    strSQL = " SELECT tblProject.Model FROM tblProduct "
    strSQL = strSQLSF & " WHERE tblProduct.Soort = '" & cboSoort & "' And  "
    strSQL = strSQLSF & " tblProduct.Type = '" & cboType & "' And "
    strSQL = strSQLSF & " tblProduct.Merk = " & cboMerk
    
    cboModel.RowSource = strSQL
    
    strSQLSF = " SELECT * FROM tblProduct "
    strSQLSF = strSQLSF & " WHERE tblProduct.Soort = '" & cboSoort & "' And  "
    strSQLSF = strSQLSF & " tblProduct.Type = '" & cboType & "' And "
    strSQLSF = strSQLSF & " tblProduct.Merk = '" & cboMerk & "'"
    

    
    Me!sfrmProduct.LinkChildFields = ""
    Me!sfrmProduct.LinkMasterFields = ""
     
    Me!sfrmProduct.LinkChildFields = "Soort;Type;Merk"
    Me!sfrmProduct.LinkMasterFields = "Soort;Type;Merk"
    Me.RecordSource = strSQLSF
    Me.Requery

End Sub


Private Sub cboModel_AfterUpdate()

     Dim strSQL As String
     Dim strSQLSF As String
    
    cboModelSoort = Null
    
    strSQL = " SELECT tblProduct.ModelSoort FROM tblProduct "
    strSQL = strSQLSF & " WHERE tblProduct.Soort = '" & cboSoort & "' And  "
    strSQL = strSQLSF & " tblProduct.Type = '" & cboType & "' And "
    strSQL = strSQLSF & " tblProduct.Merk = '" & cboMerk & "' And "
    srtSQL = strSQLSF & " tblProduct.Model= '" & cboModel & "'"
    strSQL = strSQLSF & " ORDER BY tblProuct.ModelSoort;"
    
    cboModelSoort.RowSource = strSQL
    
    strSQLSF = " SELECT * FROM tblProduct "
    strSQLSF = strSQLSF & " WHERE tblProduct.Soort = '" & cboSoort & "' And  "
    strSQLSF = strSQLSF & " tblProduct.Type = '" & cboType & "' And "
    strSQLSF = strSQLSF & " tblProduct.Merk = '" & cboMerk & "' And "
    strSQLSF = strSQLSF & " tblProduct.Model = '" & cboModel & "'"
    

    
    Me!sfrmProduct.LinkChildFields = ""
    Me!sfrmProduct.LinkMasterFields = ""
     
    Me!sfrmProduct.LinkChildFields = "Soort;Type;Merk;Model"
    Me!sfrmProduct.LinkMasterFields = "Soort;Type;Merk;Model"
    Me.RecordSource = strSQLSF
    Me.Requery
End Sub


Private Sub cboModelSoort_AfterUpdate()

Dim strSQLSF As String
    
    strSQLSF = " SELECT * FROM tblProduct"
    strSQLSF = strSQLSF & " WHERE tblProduct.Soort = '" & cboSoort & "' And  "
    strSQLSF = strSQLSF & " tblProduct.Type = '" & cboType & "' And "
    strSQLSF = strSQLSF & " tblProduct.Merk = '" & cboMerk & "' And "
    srtSQLSF = strSQLSF & " tblProduct.Model= '" & cboModel & "' And"
    strSQLSF = strSQLSF & " tblProuct.ModelSoort= '" & cboModelSoort & "'"
    strSQLSF = strSQLSF & " ORDER BY tblProuct.ModelSoort;"

    Me!sfrmProduct.LinkChildFields = ""
    Me!sfrmProduct.LinkMasterFields = ""
     
    Me!sfrmProduct.LinkChildFields = "Soort;Type;Merk;Model;ModelSoort"
    Me!sfrmProduct.LinkMasterFields = "Soort;Type;Merk;Model;ModelSoort"
    Me.RecordSource = strSQLSF
    Me.Requery

End Sub


Private Sub cmdShowAll_Click()



     cboSoort = Null
     cboType = Null
     cboMerk = Null
     cboModel = Null
     cboModelSoort = Null
     Me!sfrmProduct.LinkChildFields = ""
     Me!sfrmProduct.LinkMasterFields = ""
     Me.RecordSource = "tblProduct"
     Me.Requery
          
exit_cmdShowAll_Click:
    Exit Sub
    


End Sub

Private Sub Form_Open(Cancel As Integer)

    Dim strSQL As String
    
    strSQL = " SELECT DISTINCT tblProduct.Soort FROM tblProduct ORDER BY tblProduct.Soort;"
    cboSoort.RowSource = strSQL
    
End Sub

[ Voor 102% gewijzigd door Verwijderd op 29-06-2006 18:04 ]


  • NMe
  • Registratie: Februari 2004
  • Laatst online: 22-01 23:51

NMe

Quia Ego Sic Dico.

"Er gaat ergens wat mis in mijn 180 regels code maar ik vertel lekker niet wat en waar. Zoek het maar voor me uit." Met andere woorden: hier kan niemand iets mee. Je vertelt niet wat er fout gaat, wat voor eventuele meldingen je krijgt, je hebt zelfs niet je fout zover geisoleerd dat je alleen relevante code kan posten. Lees Programming Beleid - De "quickstart" eens door; er gaat vast een wereld voor je open.

Verder had je, als je Waar hoort mijn topic? gelezen had, geweten dat vragen met betrekking tot Access en VBA in Officesuites en -software horen. Omdat ze daar echter ook eigen inzet verwachten van een topic doe ik dit topic dicht in plaats van het te verplaatsen. Als je je aan de plaatselijke policy houdt kun je in Officesuites en -software een nieuw topic openen.

'E's fighting in there!' he stuttered, grabbing the captain's arm.
'All by himself?' said the captain.
'No, with everyone!' shouted Nobby, hopping from one foot to the other.


  • NMe
  • Registratie: Februari 2004
  • Laatst online: 22-01 23:51

NMe

Quia Ego Sic Dico.

Ik heb je sowieso al eerder gewezen op het bestaan van Officesuites en -software en de Waar hoort mijn topic?-sticky...

'E's fighting in there!' he stuttered, grabbing the captain's arm.
'All by himself?' said the captain.
'No, with everyone!' shouted Nobby, hopping from one foot to the other.


Dit topic is gesloten.