Hi,
I'm learning Access 2003 through trial and error.. (little more error than trial I've noticed..)..
I have a form, where you type what you are looking for into the combo box hit "go" and it displays the information in various text boxes. 2 problems..
1 - I would like the combo box to auto expand, attempting to "auto fill" in what the user is typing - I have auto expand as yes and it does nothing
2 - if the combo box is empty and the user hits "go" I would like a message box to pop up and ask the user to input something.
Code thus far:
Option Compare Database
Private Sub Combo207_Click()
'Declare temporary variables
Dim temp1, temp2, temp3, temp4, temp5, temp6, temp7, temp8, temp9, temp10, temp11
'Make sure that something was entered in the search field
If IsNull(temp1) Then
MsgBox ("Please enter a search item")
End If
'Read the value from the machine number textbox into a temporary variable
temp1 = Combo207.Value
'Lookup the PTZ from the table
temp2 = DLookup("[ptz_num]", "machine_data", "[machine_num] = '" & temp1 & "'")
'Lookup the Asset from the table
temp3 = DLookup("[asset_num]", "machine_data", "[machine_num] = '" & temp1 & "'")
'Lookup the fixed camera from the table
temp4 = DLookup("[fixed_num]", "machine_data", "[machine_num] = '" & temp1 & "'")
'Lookup the fixed camera from the table
temp5 = DLookup("[fixed_num]", "br_data", "[br_num] = '" & temp1 & "'")
'Lookup the PTZ from the table
temp6 = DLookup("[ptz_num]", "br_data", "[br_num] = '" & temp1 & "'")
'Lookup the phone number from the table
temp7 = DLookup("[phone_num]", "phone_data", "[depart_num] = '" & temp1 & "'")
'Lookup the alt phone number from the table
temp8 = DLookup("[alt_phone_num]", "phone_data", "[depart_num] = '" & temp1 & "'")
'Lookup the person from the table
temp9 = DLookup("[person_num]", "phone_data", "[depart_num] = '" & temp1 & "'")
'Lookup the job title from the table
temp10 = DLookup("[depart_num]", "phone_data", "[depart_num] = '" & temp1 & "'")
'Output the data to the textboxes
Text185.Value = temp2
Text181.Value = temp3
Text183.Value = temp4
Text187.Value = temp5
Text189.Value = temp6
Text193.Value = temp7
Text175.Value = temp9
Text191.Value = temp10
Text195.Value = temp8
End Sub
I'm learning Access 2003 through trial and error.. (little more error than trial I've noticed..)..
I have a form, where you type what you are looking for into the combo box hit "go" and it displays the information in various text boxes. 2 problems..
1 - I would like the combo box to auto expand, attempting to "auto fill" in what the user is typing - I have auto expand as yes and it does nothing
2 - if the combo box is empty and the user hits "go" I would like a message box to pop up and ask the user to input something.
Code thus far:
Option Compare Database
Private Sub Combo207_Click()
'Declare temporary variables
Dim temp1, temp2, temp3, temp4, temp5, temp6, temp7, temp8, temp9, temp10, temp11
'Make sure that something was entered in the search field
If IsNull(temp1) Then
MsgBox ("Please enter a search item")
End If
'Read the value from the machine number textbox into a temporary variable
temp1 = Combo207.Value
'Lookup the PTZ from the table
temp2 = DLookup("[ptz_num]", "machine_data", "[machine_num] = '" & temp1 & "'")
'Lookup the Asset from the table
temp3 = DLookup("[asset_num]", "machine_data", "[machine_num] = '" & temp1 & "'")
'Lookup the fixed camera from the table
temp4 = DLookup("[fixed_num]", "machine_data", "[machine_num] = '" & temp1 & "'")
'Lookup the fixed camera from the table
temp5 = DLookup("[fixed_num]", "br_data", "[br_num] = '" & temp1 & "'")
'Lookup the PTZ from the table
temp6 = DLookup("[ptz_num]", "br_data", "[br_num] = '" & temp1 & "'")
'Lookup the phone number from the table
temp7 = DLookup("[phone_num]", "phone_data", "[depart_num] = '" & temp1 & "'")
'Lookup the alt phone number from the table
temp8 = DLookup("[alt_phone_num]", "phone_data", "[depart_num] = '" & temp1 & "'")
'Lookup the person from the table
temp9 = DLookup("[person_num]", "phone_data", "[depart_num] = '" & temp1 & "'")
'Lookup the job title from the table
temp10 = DLookup("[depart_num]", "phone_data", "[depart_num] = '" & temp1 & "'")
'Output the data to the textboxes
Text185.Value = temp2
Text181.Value = temp3
Text183.Value = temp4
Text187.Value = temp5
Text189.Value = temp6
Text193.Value = temp7
Text175.Value = temp9
Text191.Value = temp10
Text195.Value = temp8
End Sub