raziel3
Registered User.
- Local time
- Yesterday, 22:14
- Joined
- Oct 5, 2017
- Messages
- 314
I have 3 forms that basically does the same data entry one for Inventory (deInventory), Expenses (deExpenses) and Foreign Purchases (deForeign). I have an event set up on each of them to detect available vendor credits.
After the user selects whatever I have another event on the popVENDCR to transfer the credit amount being claimed to the data entry forms.
The question. On this line Forms![deInventory].Form.txtCMAMT = txtCRUSED, instead of doing 3 different pop up forms, how can I get Forms![deInventory] to be dynamic so whatever form that triggered the pop up form, txtCRUSED will be transferred to that form's field?
Code:
Private Sub SUBTOTAL_AfterUpdate()
Dim rs As DAO.Recordset
Dim CreditCheck As String
Dim MsgBoxAns As String
CreditCheck = "SELECT VENCR.VENDISP, SUM(VENCR.AMOUNT) " & _
"FROM VENCR " & _
"WHERE VENCR.VENDISP = " & SQLQuote(txtVENDISP) & _
"GROUP BY VENCR.VENDISP " & _
"HAVING Sum(VENCR.AMOUNT)<> 0"
Set rs = CurrentDb.OpenRecordset(CreditCheck, dbOpenSnapshot)
If rs.RecordCount > 0 Then
If MsgBox("Vendor Credits Available", vbYesNo, "Apply Credits?") = vbYes Then
DoCmd.OpenForm "popVENDCR", acNormal
Forms!popVENDCR.Form.txtVENDISP = VENDISP
End If
End If
rs.Close
End Sub
After the user selects whatever I have another event on the popVENDCR to transfer the credit amount being claimed to the data entry forms.
Code:
Private Sub btnAPPCR_Click()
If txtCRUSED > txtCRTTL Then
MsgBox "Cannot Apply Credits More Than What Is Available", vbCritical, "Credit Application Error"
txtCRUSED = ""
txtCRUSED.SetFocus
Else
Forms![deInventory].Form.txtCMAMT = txtCRUSED
DoCmd.Close acForm, "popVENDCR", acSaveYes
End If
End Sub
The question. On this line Forms![deInventory].Form.txtCMAMT = txtCRUSED, instead of doing 3 different pop up forms, how can I get Forms![deInventory] to be dynamic so whatever form that triggered the pop up form, txtCRUSED will be transferred to that form's field?
Last edited: