Hi there,
I have a form with a combo box which lists contact names.
I want to make it so that when a user clicks SAVE on this form the Contact_ID instead of the Contact name gets saved.
How do I do this?
Here's the code I'm using to populate the combo box:
Dim rstInc As New ADODB.Recordset
Dim intIndex As Integer
intIndex = 0
Dim db As Connection
Set db = New Connection
db.CursorLocation = adUseClient
db.Open "PROVIDER=MSDASQL;dsn=dev;uid=scott;pwd=tiger;"
rstInc.Open "SELECT contact_id,contact_name FROM MDU_INCUMBENT ORDER BY COMPANY_NAME ASC", db, adOpenForwardOnly, adLockReadOnly
Do Until rstInc.EOF
frmAddProjectWizard.txtIncumbent.AddItem rstInc("contact_id"
& rstInc("contact_name"
, intIndex
intIndex = intIndex + 1
rstInc.MoveNext
Loop
db.Close
Set db = Nothing
Thanks so much!!
I have a form with a combo box which lists contact names.
I want to make it so that when a user clicks SAVE on this form the Contact_ID instead of the Contact name gets saved.
How do I do this?
Here's the code I'm using to populate the combo box:
Dim rstInc As New ADODB.Recordset
Dim intIndex As Integer
intIndex = 0
Dim db As Connection
Set db = New Connection
db.CursorLocation = adUseClient
db.Open "PROVIDER=MSDASQL;dsn=dev;uid=scott;pwd=tiger;"
rstInc.Open "SELECT contact_id,contact_name FROM MDU_INCUMBENT ORDER BY COMPANY_NAME ASC", db, adOpenForwardOnly, adLockReadOnly
Do Until rstInc.EOF
frmAddProjectWizard.txtIncumbent.AddItem rstInc("contact_id"
intIndex = intIndex + 1
rstInc.MoveNext
Loop
db.Close
Set db = Nothing
Thanks so much!!