Form autofill

aron.ridgway

Registered User.
Local time
Today, 11:48
Joined
Apr 1, 2014
Messages
148
Hi There

I need a little help figuring out how to do something, i've got a datasheet form for filling out an order which has both quantity and cost.

What i want is if they skip typing in the quantity and type in the cost, then it will automatically fill in the quantity as 1. but only if the qty is blank while typing the cost.

if the qty is put in 1st then nothing happens?

thanks in advanced
 
You could set a default on the qty field to be 1. Otherwise you could add some VBA to the AfterUpdate of the cost field which would be something like this:

Code:
if Not IsNull(me!CostField) and IsNull(Me!QtyField) then
 Me!QtyField = 1
end if
 
Thank you James!

with some tiny adjustment it works a treat thank you!

Code:
Private Sub Cost_AfterUpdate()
If Not IsNull(Me.Cost) And IsNull(Me.Qty) Then
Me.Qty = 1
End If
End Sub
 

Users who are viewing this thread

Back
Top Bottom