Getting a label to Requery!

  • Thread starter Thread starter Bob Vance
  • Start date Start date
B

Bob Vance

This code works on my form when I select "Yes" but if I open my Form and
"Yes" is Slected my Label lblCashSale is not Visible , lblCashSale has a No
Visible set
Thanks Bob

If cmbCashSale.value = "Yes" Then
lblCashOn.Visible = True

Else
lblCashOn.Visible = False
End If
 
Bob,

I assume you mean you have this code on the After Update event of the
combobox?

You might need to put similar code on the form's Current event as well.

By the way, you can shortcut to just one line of code:

Me.lblCashOn.Visible = Me.cmbCashSale = "Yes"
 
Thanks Steve , I had to use mine in current yours was giving me an
error.........Thanks Bob

Private Sub Form_Current()
Me.cmbCashSale.Requery
If cmbCashSale.value = "Yes" Then
lblCashOn.Visible = True

Else
lblCashOn.Visible = False
End If
End Sub
 
I see, Bob. To take care of the situation where there is nothing
entered in the combobox, maybe you need:
Me.lblCashOn.Visible = Nz(Me.cmbCashSale, "") = "Yes"
 
you don't speak french?


Bob Vance said:
Thanks Steve , I had to use mine in current yours was giving me an
error.........Thanks Bob

Private Sub Form_Current()
Me.cmbCashSale.Requery
If cmbCashSale.value = "Yes" Then
lblCashOn.Visible = True

Else
lblCashOn.Visible = False
End If
End Sub
 

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