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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AutoFill in access

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
J3 L U N T here...

the scenario:
one TABLE with 3 colomns -- OFFICE, CONTACT, PHONE

one FORM with 3 fields -- OFFICE [combo box], CONTACT [text field], PHONE [text field].

the question:
how do i set the CONTACT and PHONE text fields to automatically display after i have choosen an office from the OFFICE combo box.

PLEASE HELP... I KNOW THIS IS AN EASY QUESTION FOR ALL YOU GUYS!!!!
 
The primary purpose for the combo box is the set a value for a data record. It can be used to go to records. The following code implements a multi-function combo box to do as you are requesting. I select an option from an option box (CP/N, LCN, NIIN) that sets the ControlSource on the combo box. Then the AfterUpdate event on the combo box reads the value of the option box to determine what action to perform. One moves to the correct record and another filters the data.

Private Sub cboQFind_AfterUpdate()

Dim intCtr As Integer
Dim strFilter As String

Select Case Me.fraQuickFindType
Case CPN_SELECTED
Set rst = Me.RecordsetClone
rst.FindFirst "[CP/N]='" & Me.cboQFind & "'"
If rst.NoMatch Then
'
Else
Me.Bookmark = rst.Bookmark
End If
rst.Close
Case LCN_SELECTED
Me.Filter = "LCN='" & Me.cboQFind & "'"
Me.FilterOn = True
Case NIIN_SELECTED
Set rst = Me.RecordsetClone
rst.FindFirst "[NIIN]='" & Me.cboQFind & "'"
If rst.NoMatch Then
'
Else
Me.Bookmark = rst.Bookmark
End If
rst.Close
End Select
Set rst = Nothing

End Sub

Steve King Growth follows a healthy professional curiosity
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top