KavJack
Programmer
- Apr 1, 2001
- 46
I have the following code in a Form :
Private Sub Client_Bldg___Change()
Dim Client_No As Variant
Dim Client_Addr1 As Variant
Dim strCity, strState, strZip, strCrit As Variant
If Left(Me.Client_Bldg__, 1) = "1" Then
Client_No = 1
Me.Client_Internal__ = Client_No
End If
strCrit = "Client_Bldg_No = """ & Me.Client_Bldg__ & """"
Me.Text92 = DLookup("Project_Address", "tblBuildings", strCrit)
strCity = DLookup("Project_City", "tblBuildings", strCrit)
strState = DLookup("Project_St", "tblBuildings", strCrit)
strZip = DLookup("Project_Zip", "tblBuildings", strCrit)
If Len(Nz(strCity, 1)) < 2 Then
str01 = ""
Else
If Len(Nz(strState, 1)) > 1 Then
str01 = strCity & ", " & strState & " "
Else
str01 = strCity
End If
End If
Me.Text94 = str01 & strZip
Me.Refresh
End Sub
This code is supposed to take a particular Project building number and display the Buildings address in Text92 and the City,State, and Zip in Text94. The code works sometimes but it doesn't seem to respond in other cases when I am scrolling through the records in the Projects Table upon which the Form is built. The Projects Table is tblProjects which contains a Client Building Number field. The Buildings table is tblBuildings and contains a list of all the building numbers with their associaeted addresses.
There seems to be some kind of delay happening in the Text92 and Text94 fields being displayed. I want the display of these two text boxes to be instantaneous. Any advice here ?
Private Sub Client_Bldg___Change()
Dim Client_No As Variant
Dim Client_Addr1 As Variant
Dim strCity, strState, strZip, strCrit As Variant
If Left(Me.Client_Bldg__, 1) = "1" Then
Client_No = 1
Me.Client_Internal__ = Client_No
End If
strCrit = "Client_Bldg_No = """ & Me.Client_Bldg__ & """"
Me.Text92 = DLookup("Project_Address", "tblBuildings", strCrit)
strCity = DLookup("Project_City", "tblBuildings", strCrit)
strState = DLookup("Project_St", "tblBuildings", strCrit)
strZip = DLookup("Project_Zip", "tblBuildings", strCrit)
If Len(Nz(strCity, 1)) < 2 Then
str01 = ""
Else
If Len(Nz(strState, 1)) > 1 Then
str01 = strCity & ", " & strState & " "
Else
str01 = strCity
End If
End If
Me.Text94 = str01 & strZip
Me.Refresh
End Sub
This code is supposed to take a particular Project building number and display the Buildings address in Text92 and the City,State, and Zip in Text94. The code works sometimes but it doesn't seem to respond in other cases when I am scrolling through the records in the Projects Table upon which the Form is built. The Projects Table is tblProjects which contains a Client Building Number field. The Buildings table is tblBuildings and contains a list of all the building numbers with their associaeted addresses.
There seems to be some kind of delay happening in the Text92 and Text94 fields being displayed. I want the display of these two text boxes to be instantaneous. Any advice here ?