Hi everyone,
I have a form Incoming there this required field: ECID, ItemID,StatisID and ShelfID.
Can I set required rule and msg box to this field in form?
thank you
Hi everyone,
I have a form Incoming there this required field: ECID, ItemID,StatisID and ShelfID.
Can I set required rule and msg box to this field in form?
thank you
You can create rules at the table level to require fields (Validation Rule and Validation Text properties), but I find this confusing. I prefer to use VBA to manage constraints. This way, I can look at the VBA to understand most all of the rules and I do not have hidden rules in the properties of tables.
I agree with ItsMe, about being able to go into the code module and have everything right there! It's one of the reasons why I also prefer VBA code over Embedded Macros.
There are a number of ways to approach this, the clearest for newbies would probably be something like this:
Code:Private Sub Form_BeforeUpdate(Cancel As Integer) If Nz(Me.ECID,"") = "" Then MsgBox "ECID Must Not Be Left Blank!" Cancel = True ECID.SetFocus Exit Sub End If If Nz(Me.ItemID,"") = "" Then MsgBox "ItemID Must Not Be Left Blank!" Cancel = True ItemID.SetFocus Exit Sub End If If Nz(Me.StatisID,"") = "" Then MsgBox "StatisID Must Not Be Left Blank!" Cancel = True StatisID.SetFocus Exit Sub End If If Nz(Me.ShelfID,"") = "" Then MsgBox "ShelfID Must Not Be Left Blank!" Cancel = True ShelfID.SetFocus Exit Sub End If End Sub
Linq ;0)>
Thank you for reply.
Last edited by vugar; 10-21-2015 at 02:19 AM.
I have two main tables of incoming and outgoing.
I have crate stock Query with following fields
ItemID (Group By) , StatusID (Group By), Quantity (Sum)
And In Outgoing Form
ItemID, StatusID, ReceivedQuantity
I don't want the user to give a qty more than the qty available in the Stock.
I write validation rule in Outgoing Form-ReceivedQuantity: <=Nz(DLookUp("[SumOfQuantity]","[TotalInStock]"," ItemID = " & [ItemID] & "And [Status ID] = " & [Status ID]),0)
As I understanding it would better if I write it on VBA.
My problem that I new in VBA. So I can't do it.
duplicate post here
http://www.access-programmers.co.uk/...d.php?t=281863
Can you give your idea please, what should i use here, thanks in advanced.
The link didn't work Ajax, not sure if removed or mistake. Just FYI