Enter Parameter Value

  • Thread starter Thread starter Simon
  • Start date Start date
S

Simon

I have an append query. the append query works fine,

On my form i have a button that i clcik to run the querys, it then
brings up a ' Enter Parameter Value' ' Wuantity to be retunred'

This then lets be type in the quantity to be retunred

On my from shows how many have been bought. If there a way that in i
enter an about greater than the amount that have been bought then it
will bring up an error message to say that ' you can not return more
than have been bought'


thanks

Simon
 
I have an append query. the append query works fine,

On my form i have a button that i clcik to run the querys, it then
brings up a ' Enter Parameter Value' ' Wuantity to be retunred'

This then lets be type in the quantity to be retunred

On my from shows how many have been bought. If there a way that in i
enter an about greater than the amount that have been bought then it
will bring up an error message to say that ' you can not return more
than have been bought'

I'd suggest changing the [Quantity to be returned:] prompt to point to
your Form. If you put an unbound (nothing in its Control Source)
textbox on the form, named txtReturnQuantity, you can use a parameter

[Forms]![NameOfYourForm]![txtReturnQuantity]

in the query; and you can check the amount entered by putting code in
the textbox's BeforeUpdate event:

Private Sub txtReturnQuantity_BeforeUpdate(Cancel as Integer)
If Me.txtReturnQuantity > Me.QuantityBought Then
Cancel = True
Me.txtReturnQuantity.Undo
MsgBox "You cannot return more than you have bought", vbOKOnly
End If
End Sub

John W. Vinson[MVP]
 

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

Similar Threads


Back
Top