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

Change values on change in text box

Status
Not open for further replies.

jazminecat23

Programmer
Mar 16, 2007
103
US
Hi all -

this is so basic, and I know I knew how to do it at one time, I'm embarrassed to post it here, but here goes.

I have a form with 3 fields I want to work together. Vendor_Num, Status, and Status2. When the user changes Vendor_Num from the default value of 0 to anything else, I want Status to change to True, and Status2 to change to Done. Status2 is unbound, it's there just for the user's info. Status isn't visible, but is bound to the table.

Here's my code:

Code:
[green]this works fine[/green]
Private Sub Form_Current()
  If Me.VENDOR_NUM = 0 Then
    Me.Status2 = "New"
    Else: Me.Status2 = "Done"
    End If
    
End Sub

[red]this doesn't work[/red]
Private Sub VENDOR_NUM_Change()
    If Me.VENDOR_NUM > 0 Then
    Me.STATUS = "True"
    Me.Status2 = "Done"
    Me.Refresh
    End If
End Sub

Basically, once the user enters a number other than 0 in the vendor number field, I want it to change Status to True, and Status2 to Done. Currently it doesn't change the value in either one at all. I only see the different ("Done") value in Status2 when I open the form.

Thanks in advance.
 
Get rid of Me.Refresh and add similar code to the current event. That should do it.
 
Thanks! I knew it had to be something simple. Have a good Monday!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top