AHMEDRASHED
Member
- Local time
- Today, 23:37
- Joined
- Feb 2, 2020
- Messages
- 59
Hello , I have Form to convert ,
Example to convert :
05JAN ARNCDG (D) | 10JAN CDGARN (I) |
06JAN DXBBEY (Q) | 04APR BEYDXB (Q) |
19JAN BEYRUH (K) | |
Example Result :
STOCKHOLM-PARIS-STOCKHOLM DATED ON 05JAN-10JAN
DUBAI-BEIRUT-DUBAI DATED ON 06JAN -04APR
BEIRUT-RIYADH DATED 19JAN
i got this erorr : any help please
Module code :
Public Function ConvertFlight(flightText As String) As String
' Split the flight text into its parts
Dim parts() As String
parts = Split(flightText, " ")
' Look up the city names based on the IATA codes
Dim depCity As String
Dim arrCity As String
depCity = DLookup("City", "tblAirport", "IATA Code = '" & Left(parts(1), 3) & "'")
arrCity = DLookup("City", "tblAirport", "IATA Code = '" & Mid(parts(1), 4, 3) & "'")
' Create the converted text
ConvertFlight = depCity & "-" & arrCity & " dated on " & parts(0) & " - " & Mid(parts(2), 1, Len(parts(2)) - 1)
End Function
CmdConvert_Click code :
Private Sub CmdConvert_Click()
Dim flightText As String
Dim convertedText As String
flightText = Me.inputText.Value
convertedText = ConvertFlight(flightText)
Me.OutputText.Value = convertedText
End Sub