Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why not works?

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hello, All,

I have a form works fine in MS Access. but I import this form and table into MS Access Project from MS Access that form works is not complete. The following are my codes:


Private Sub cboGetTerr_AfterUpdate()
Dim st1 As String, ST2 As String, st3 As String, st4 As String, sql As String
st1 = "SELECT TAXI_TERR.MC_NUM FROM TAXI_TERR"
ST2 = "SELECT DISTINCT TAXI_TERR.CARRIER FROM TAXI_TERR ORDER BY CARRIER"
st3 = "SELECT DISTINCT TAXI_TERR.DBA FROM TAXI_TERR WHERE NOT(DBA IS NULL) ORDER BY DBA"
st4 = "SELECT TAXI_TERR.TERRITORY FROM TAXI_TERR ORDER BY TERRITORY"

Select Case cboSearchType
Case "MC #"
sql = "SELECT * FROM TAXI_TERR WHERE MC_NUM = '" & cboGetTerr.Value & "'"
Case "CARRIER"
sql = "SELECT * FROM TAXI_TERR WHERE CARRIER LIKE '*" & cboGetTerr.Value & "*'"
Case "DBA"
sql = "SELECT * FROM TAXI_TERR WHERE DBA LIKE '*" & cboGetTerr.Value & "*'"
Case "Territory"
sql = "SELECT * FROM TAXI_TERR WHERE TERRITORY LIKE '*" & cboGetTerr.Value & "*'"
End Select

Me.RecordSource = sql
Me.Requery

End Sub

Private Sub cboSearchType_AfterUpdate()
Dim st1 As String, ST2 As String, st3 As String, st4 As String
st1 = "MC #"
ST2 = "CARRIER"
st3 = "DBA"
st4 = "Territory"

Select Case cboSearchType
Case Is = st1
Me.cboGetTerr.RowSource = "SELECT DISTINCT TAXI_TERR.MC_NUM FROM TAXI_TERR"
Case Is = ST2
Me.cboGetTerr.RowSource = "SELECT DISTINCT TAXI_TERR.CARRIER FROM TAXI_TERR ORDER BY CARRIER"
Case Is = st3
Me.cboGetTerr.RowSource = "SELECT DISTINCT TAXI_TERR.DBA FROM TAXI_TERR WHERE DBA is not null ORDER BY DBA"
Case Is = st4
Me.cboGetTerr.RowSource = "SELECT DISTINCT TAXI_TERR.TERRITORY FROM TAXI_TERR ORDER BY TERRITORY"
End Select
Me.cboGetTerr.Requery
Me.cboGetTerr = ""
End Sub


Highly appicate.

Karen
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top