dbmanalser84
Registered User.
- Local time
- Today, 09:49
- Joined
- Feb 26, 2008
- Messages
- 52
m creating a database that has records of all my travels and the money I've spent for each.
I have for with 3 combo boxes:
1. Relation - it has all travel destinations. For now it has only two (Nis - Aleksinac) and (Aleksinac - Nis)
2. Travel agency - it has all the companies I've traveled with
3. Tim of departure - It has all the departure times
Now, the first two combo boxes store numbers in the table but they are Lookup fields to two other tables. The field names are (intRelationID & intAgencyID).
The 3rd combo box stores text in the following format (hh:mm_h), and the source of its data is in fact from the entered values, in the same table that the Form is based on, from the (txtDepartureTime) field,
but the source of the field is calculated with the following VBA:
The intAgencyID combo box After Update Event contains following code
So the code doesn't display the message Empty if I choose the criteria that doesn't return any Departure times. How do I fix this?
Thanx
I have for with 3 combo boxes:
1. Relation - it has all travel destinations. For now it has only two (Nis - Aleksinac) and (Aleksinac - Nis)
2. Travel agency - it has all the companies I've traveled with
3. Tim of departure - It has all the departure times
Now, the first two combo boxes store numbers in the table but they are Lookup fields to two other tables. The field names are (intRelationID & intAgencyID).
The 3rd combo box stores text in the following format (hh:mm_h), and the source of its data is in fact from the entered values, in the same table that the Form is based on, from the (txtDepartureTime) field,
but the source of the field is calculated with the following VBA:
The intAgencyID combo box After Update Event contains following code
Code:
Private Sub intAgencyID_AfterUpdate()
Dim agency As Integer
Dim relation As Integer
Dim DepartureTime As Control
agency = Forms![frmTicketEntry]![intAgencyID].Value
relation = Forms![frmTicketEntry]![intRelationID].Value
Set DepartureTime = Forms![frmTicketEntry]![txtDepartureTime]
DepartureTime .RowSource = "SELECT DISTINCT tblTicket.txtDepartureTime FROM tblRelation INNER JOIN (tblAgency INNER JOIN tblTicket ON tblAgency.intAgencyID = tblTicket.intAgencyID) ON tblRelation.intRelationID = tblTicket.intRelationID WHERE (((tblAgency.intAgencyID)=" & agency & " AND tblRelation.intRelationID = " & relation & "));"
DepartureTime.Value = Departure.ItemData(0)
' DepartureTime.Value = "" Or
If DepartureTime.ItemData(0) = "" Then
DepartureTime.Value = "Empty"
End If
End Sub
So the code doesn't display the message Empty if I choose the criteria that doesn't return any Departure times. How do I fix this?
Thanx