Setting Values

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

I have written some code but if someone can help me finish it up. Basically
what I am trying to do is I have a cascading combo box. I want the user when
he selects his reponse (cmbStatus) will automatically update the other text
box (response).
I just want to know if I could set the value in VB.

But If not How do you set the value in a Macro. I know the first step is
run the code, but do not know how to do the rest. Thanks

Private Sub cmbStatus_AfterUpdate()

On Error Resume Next
Select Case cmbStatus.Value
Case "Not Prepared"
Response.RowSource = " "
Case "Prepared No Disposition"
Response.RowSource = "Reconciled"
Case "Prepared Disposition Known"
Response.RowSource = "Reconciled"
Case "Prepared Disposition unknown"
Response.RowSource = "Unreconciled"
End Select
End Sub

I have written the code to display the response in the text box response.
But I want to know if I could change this code to set the value. Thanks.
 
Are "Reconciled" and "Unreconciled" table names or query names in your db,
or are they text with which you'd like to populate a text box named
Response? I suspect it is the latter. A textbox control doesn't have a row
source; only comboboxes and listboxes have them. A textbox has a control
source, which tells access to which field in your table it is bound. Perhaps
what you're after is:

Private Sub cmbStatus_AfterUpdate()

On Error Resume Next
Select Case cmbStatus.Value
Case "Not Prepared"
Me.Response = " "
Case "Prepared No Disposition"
Me.Response = "Reconciled"
Case "Prepared Disposition Known"
Me.Response = "Reconciled"
Case "Prepared Disposition unknown"
Me.Response = "Unreconciled"
End Select
End Sub

If "Reconciled" and "Unreconciled" are in fact table names, then you've got
serious design issues to address.

Brian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top