Siggi
New member
- Local time
- Today, 21:33
- Joined
- Jun 25, 2009
- Messages
- 4
Dear experts,
Woul like to call in your help and expertise on a problem I can't figure out.
In my database I have a form Trade with 5 comboboxes: Supplier, Country, Port, Equipment and Brand. Here I can enter which supplier is offering which Equipment of which brand in which country/port.
I'm trying to link the Country and Port comboboxes sothat when you make a selection in the Country combobox, the Port combobox is filtered showing the available selection of ports for that country.
I have below codes but when running, the value in the Country field is showing the same value in all the records(???), when I select another record I get the value for that record shown in all the Country fields off all the other records!???
I'm doing something wrong but can't find the mistake, can anybody help me out? Thanks. Kind regards, Siggi.
Private Sub Form_Current()
If Me.portID <> 0 Then
Me.Keuzeland = DLookup("CountryID", "TblPort", "portID=" & Me.portID)
Me.portID.RowSource = "SELECT portID, PortName FROM TblPort WHERE CountryID =" & Me.Keuzeland & " ORDER By PortName"
Else
Me.Keuzeland = ""
Me.portID.RowSource = ""
End If
End Sub
Private Sub KeuzeLand_AfterUpdate()
Me.portID = Null
Me.portID.RowSource = "SELECT PortID, PortName FROM TblPort WHERE CountryID =" & Me.Keuzeland & " ORDER By PortName"
Me.Refresh
End Sub
Woul like to call in your help and expertise on a problem I can't figure out.
In my database I have a form Trade with 5 comboboxes: Supplier, Country, Port, Equipment and Brand. Here I can enter which supplier is offering which Equipment of which brand in which country/port.
I'm trying to link the Country and Port comboboxes sothat when you make a selection in the Country combobox, the Port combobox is filtered showing the available selection of ports for that country.
I have below codes but when running, the value in the Country field is showing the same value in all the records(???), when I select another record I get the value for that record shown in all the Country fields off all the other records!???
I'm doing something wrong but can't find the mistake, can anybody help me out? Thanks. Kind regards, Siggi.
Private Sub Form_Current()
If Me.portID <> 0 Then
Me.Keuzeland = DLookup("CountryID", "TblPort", "portID=" & Me.portID)
Me.portID.RowSource = "SELECT portID, PortName FROM TblPort WHERE CountryID =" & Me.Keuzeland & " ORDER By PortName"
Else
Me.Keuzeland = ""
Me.portID.RowSource = ""
End If
End Sub
Private Sub KeuzeLand_AfterUpdate()
Me.portID = Null
Me.portID.RowSource = "SELECT PortID, PortName FROM TblPort WHERE CountryID =" & Me.Keuzeland & " ORDER By PortName"
Me.Refresh
End Sub