clebo99
01-06-2005, 11:01 AM
Hey,
I have a combobox in a form that has a list of say system names from a SQL DB, single table. On the form are other text boxes, labels etc that would contain inventory information.
What I want to do is when I select the system name in the combo box, the inventory information comes up. I know this is easily done if I add a command button named "Search" or something, but I want this to occur the second the selection has been made in the combo box.
I thought that the "Change" control on the combo box did this but it's not working. I even put in a test MSGBOX to pop up when this action occurs but that is not occurring.
Code:
Dim infolist As New ADODB.Recordset
.
.
.
.
.
Private Sub Serverlist_Change()
MainForm.Refresh
Dim str As String
MsgBox "Combo Box Info Changed"
'setting all labels and boxes to blank
IPLabel.Caption = ""
NetworkCardLabel.Caption = ""
StorageLabel.Caption = ""
FailoverLabel.Caption = ""
BackupStatus.Text = ""
DataDirectories.Text = ""
Failoversteps.Text = ""
Localadmins.Text = ""
opendatabase
With infolist
.ActiveConnection = cn
.CursorType = adOpenForwardOnly
.LockType = adLockReadOnly
.Open "SELECT * FROM sysinfo WHERE Sysname='" & Serverlist.Text & "'"
' Put entries into data here....
IPLabel.Caption = !sysip
NetworkCardLabel.Caption = !sysnetcard
StorageLabel.Caption = !sysstorage
FailoverLabel.Caption = !sysfailstatus
BackupStatus.Text = !sysbackup
DataDirectories.Text = !sysdata
Failoversteps.Text = !sysfailover
Localadmins.Text = !sysadmins
Wend
.Close
MainForm.Refresh
Thoughts?
Chris, Baltimore
I have a combobox in a form that has a list of say system names from a SQL DB, single table. On the form are other text boxes, labels etc that would contain inventory information.
What I want to do is when I select the system name in the combo box, the inventory information comes up. I know this is easily done if I add a command button named "Search" or something, but I want this to occur the second the selection has been made in the combo box.
I thought that the "Change" control on the combo box did this but it's not working. I even put in a test MSGBOX to pop up when this action occurs but that is not occurring.
Code:
Dim infolist As New ADODB.Recordset
.
.
.
.
.
Private Sub Serverlist_Change()
MainForm.Refresh
Dim str As String
MsgBox "Combo Box Info Changed"
'setting all labels and boxes to blank
IPLabel.Caption = ""
NetworkCardLabel.Caption = ""
StorageLabel.Caption = ""
FailoverLabel.Caption = ""
BackupStatus.Text = ""
DataDirectories.Text = ""
Failoversteps.Text = ""
Localadmins.Text = ""
opendatabase
With infolist
.ActiveConnection = cn
.CursorType = adOpenForwardOnly
.LockType = adLockReadOnly
.Open "SELECT * FROM sysinfo WHERE Sysname='" & Serverlist.Text & "'"
' Put entries into data here....
IPLabel.Caption = !sysip
NetworkCardLabel.Caption = !sysnetcard
StorageLabel.Caption = !sysstorage
FailoverLabel.Caption = !sysfailstatus
BackupStatus.Text = !sysbackup
DataDirectories.Text = !sysdata
Failoversteps.Text = !sysfailover
Localadmins.Text = !sysadmins
Wend
.Close
MainForm.Refresh
Thoughts?
Chris, Baltimore