My form is opening with three select case conditions, "Receipt, Transfer and Adjustment".
At the time of transfer, If the stock balance of any item is null then the quantity field should have to be disabled for data entry and should have to show a message. These fields are available on the subform. I have tried but not getting the results.
Main Form Name: frmTransactionsMain
Sub Form Namr: frmTransactions Sub
Sub Form Fields:
Items, Quantity, PackingSize, QOH (DSum value coming from query)
I am using the following code on the main form at the time of opening.
Code:
Select Case Me.OpenArgs
Case "Receipt"
With Me
.lbleceipt.Visible = True
.lblTransfer.Visible = False
.lblAdjustment.Visible = False
.EntityFK.Visible = False
.EntityFK_Label.Visible = False
.VendorsFK.Visile = True
.VendorsFK_Label.Visible = True
.TranTypeFK.RowSource = "SELECT TranTypePK, TranType from tblTranTypes WHERE TranTypePK<=2"
.TranTypeFK.ColumnCount = 2
.TranTypeFK.ColumnWidths = "0;1cm"
.TranTypeFK.DefaultValue = 1
End With
Case "Transfer"
With Me
.lblReceipt.Visible = False
.lblTransfer.Visible = True
.lblAdjustment.Visible = False
.EntityFK.Visible = True
.EntityFK_Label.Visible = True
.VendorsFK.Visible = False
.VendorsFK_Label.Visible = False
.TranTypeFK.RowSource = "SELECT TranTypePK, TranType from tblTranTypes WHERE TranTypePK>=3"
.TranTypeFK.ColumnCount = 2
.TranTypeFK.ColumnWidths = "0;1cm"
.TranTypeFK.DefaultValue = 3
End With
I want to make two conditions after update event in "items" field on subform.
1st condition: it will check after update of "Items" which case statement is open in mainform, if the case statement is "Transfer" then it will apply a 2nd condition.
2nd condition: after update event "items", if the quantity on hand is zero or null then pop up a message and disable the data entry in quantity field.
I'm not at all clear on what you want. I think what you are saying is that when an item is selected, if there isn't any stock, then the user should not be able to select a quantity?
I was trying to solve through VBA coding because I have only one form to receive inventory, transfer of inventory, etc with six transactions types.
And every transaction type have a link on dashboard with different scenarios but basically at the backend only one table and at the front one form opening with different scenarios.
As I had already told my form is opening through select case statements if one is visible to true the others visibility false.
So, i have solved through applying Nested If statements.
On the other hand, as you suggested, if you are receiving items with zero stock then this was not possible to see those items as you had filtered through a query as only one table for all scenarios to work.
Anyhow, I apologise on my words. I know you are most experienced and professional and I am just a beginner.