Visible TxtBox if......

J

Jomar Kjøsnes

Hey.
I have an Main menu in my access program.
I want a message to pop up when a field in a query reach a value(eks >0 ).
The query name is qryMinimumslagerF and the field in it is called
Minimumslager.

I have a code like this:

Private Sub TxtVarsel_BeforeUpdate(Cancel As Integer)
If ([qryMinimumslagerF].[Minimunslager]) <> "" Then
Me.TxtVarsel Visible = True
Else
Me.TxtVarsel Visible = False
End If

Its in the Before update event in the text box on the main menu i want to
pop up.

I suggest I'v placed the code in wrong place, or is it any other more easy
way to do this.

Regards Jk
 
E

Ed Metcalfe

Jomar Kjøsnes said:
Hey.
I have an Main menu in my access program.
I want a message to pop up when a field in a query reach a value(eks >0 ).
The query name is qryMinimumslagerF and the field in it is called
Minimumslager.

I have a code like this:

Private Sub TxtVarsel_BeforeUpdate(Cancel As Integer)
If ([qryMinimumslagerF].[Minimunslager]) <> "" Then
Me.TxtVarsel Visible = True
Else
Me.TxtVarsel Visible = False
End If

Its in the Before update event in the text box on the main menu i want to
pop up.

I suggest I'v placed the code in wrong place, or is it any other more easy
way to do this.

Regards Jk

If TxtVarsel is invisible then it will never have a BeforeUpdate event fire.

I'm not sure, but I think you want to place the code behind the form's
OnCurrent event - this way the code will run as you move through records on
the form.

Ed Metcalfe.
 

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

Top