I started pulling my hair out~. I am not experienced with coding and Access overall, but the project fell on my laps and I had to start learning it.
I’ve read the FAQs provided on this site thoroughly re combo boxes, but I can not make it work.
I have 2 combo boxes (AirportID and TerminalID) pulling out the information from the following tables:
AIRPORTS (table)
AirportID )PK
AirportCode
AirportName
TERMINALS(table)
TerminalID )PK
TerminalName
AirportID )FK
I want to be able to select an airport name in the first combo box (AirportID) which then causes a second combo box (TerminalID) to bring out the Terminals for that specific airport.
In the first combo box (AirportID) I have:
SELECT AIRPORTS.AirportID, AIRPORTS.AirportCode
FROM AIRPORTS
ORDER BY AIRPORTS.AirportCode;
Events:
Private Sub AirportID_AfterUpdate()
TerminalID.Requery
End Sub
Combo2 (TerminalID)
SELECT TERMINALS.TerminalID, TERMINALS.TerminalName, TERMINALS.AirportID
FROM TERMINALS
WHERE ((([TERMINAL].[AirportID])=[Forms]![airline activity]![AirportID]))
ORDER BY TERMINALS.TerminalName;
Event:
Private Sub TerminalID_GotFocus()
If Len(Trim(Nz(AirportID, "") & "")) = 0 Then
MsgBox "Please Specify Airport first"
AirportID.SetFocus
Else
TerminalID.Requery
End If
End Sub
I don’t know what I am doing wrong but when I try to open the form in form view: “enter parameter value” message pop-ups and ask me for “Terminal.AirportID?”
Please help! Thanks,
O.
I’ve read the FAQs provided on this site thoroughly re combo boxes, but I can not make it work.
I have 2 combo boxes (AirportID and TerminalID) pulling out the information from the following tables:
AIRPORTS (table)
AirportID )PK
AirportCode
AirportName
TERMINALS(table)
TerminalID )PK
TerminalName
AirportID )FK
I want to be able to select an airport name in the first combo box (AirportID) which then causes a second combo box (TerminalID) to bring out the Terminals for that specific airport.
In the first combo box (AirportID) I have:
SELECT AIRPORTS.AirportID, AIRPORTS.AirportCode
FROM AIRPORTS
ORDER BY AIRPORTS.AirportCode;
Events:
Private Sub AirportID_AfterUpdate()
TerminalID.Requery
End Sub
Combo2 (TerminalID)
SELECT TERMINALS.TerminalID, TERMINALS.TerminalName, TERMINALS.AirportID
FROM TERMINALS
WHERE ((([TERMINAL].[AirportID])=[Forms]![airline activity]![AirportID]))
ORDER BY TERMINALS.TerminalName;
Event:
Private Sub TerminalID_GotFocus()
If Len(Trim(Nz(AirportID, "") & "")) = 0 Then
MsgBox "Please Specify Airport first"
AirportID.SetFocus
Else
TerminalID.Requery
End If
End Sub
I don’t know what I am doing wrong but when I try to open the form in form view: “enter parameter value” message pop-ups and ask me for “Terminal.AirportID?”
Please help! Thanks,
O.