Newbie- Textbox validation

  • Thread starter Thread starter Bauji
  • Start date Start date
B

Bauji

I am not a access programmer, in existing access application, there is one invoice form in which I want to put a validation on textbox (quantity) that if user can not enter more than displayed quantiry, however he can enter less quantity as displayed quantiry, othere wise an error message should displayed..

Secondly How I can use one more query in an data bound form?

So let me know how do I make it or let me know is there any good access turorial to make a correction in current application.
 
In the BeforeUpdate event of the textbox try something like this (air code):

Sub txtWhatever_BeforeUpdate(Cancel As Integer)
If Me.txtWhatever > Me.txtToCompareWith Then
MsgBox " Too High"
Me.txtWhatever.SetFocus
Cancel = True
End If
End Sub
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access

I am not a access programmer, in existing access application, there is one
invoice form in which I want to put a validation on textbox (quantity) that
if user can not enter more than displayed quantiry, however he can enter
less quantity as displayed quantiry, othere wise an error message should
displayed..

Secondly How I can use one more query in an data bound form?

So let me know how do I make it or let me know is there any good access
turorial to make a correction in current application.
 
I also got following error

*----------------------------------------------------------------
Runtime eror 2018:

You must save the field before you execute the gotocontrol execution
the gotocontrol method, or the setfocus method.
*----------------------------------------------------------------

Let me know how should I handle this?
 
You cannot compare the count with a Controlsource. Comparing it with itself
doesn't make much sense either since it will always be equal. (or Null)

Specifically, what are you trying to do? Tell me exactly what the names of
the 2 text boxes to compare.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
I am not sure that I understand. The displayed value should be the same as
the entered value. If you are updating an existing record there is the
..OldValue property, which is the value of the control before the editing is
commited. You can access that in code with something like:

Sub Form_BeforeUpdate(Cancel As Integer)

MsgBox "Old Value: " & Me.txtSomeData.OldValue & ", New Value: " &
Me.txtSomeData

End Sub
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
Back
Top