The Form has unbound txt and cbo fields that is linked to a subform. The form also has a Query, Edit, Update, Clear Button
Query Button Code
Expand|Select|Wrap|Line Numbers
- Private Sub cmdbtnQuery_Click()
- me.subformSupplyRqmtsUpdate.Requery
Expand|Select|Wrap|Line Numbers
- Private Sub cmdbtnEdit_Click()
- If Not (Me.subformSupplyRqmtsUpdate.Form.Recordset.EOF and Me.subformSupplyRqmtsUpdate.Form.Recordset.BOF) Then
- With Me.txtSupplyRqmtsID = .Fields("SupplyRqmtsID")
- Me.cboUsingLoc = .Fields("UsingLoc")
- Me.txtFicalYear = .Fields("FiscalYear")
- Me.txtState = .Fields("State")
- 'store id of Supply Rqmts in Tag of txtSupplyRqmtsId in case ID is modified
- Me.txtSupplyRqmtsID.Tag = .Fields("SupplyRqmtsID")
Expand|Select|Wrap|Line Numbers
- Private Sub cmdbtnEdit_Click()
- CurrentDb.Execute "UPDATE tblSupplyItemRequirement " & _
- " SET FiscalYear=" & Me.txtFiscalYear & _
- ", UsingLoc='" & Me.cboUsingLoc & "'" & _
- ", State='" & me.txtState & "'" & _
- "WHERE SupplyRqmtsID=" & Me.txtWrmRqmtsID.Tag
Expand|Select|Wrap|Line Numbers
- Private Sub cmdbtnEdit_Click()
- When Button is clicked clears all the fields on the main form to Reset the form to query or Add
- Me.txtWrmRqmtsID.Tag = Null
- Me.txtFiscalYear = Null
- Me.cboUsingLoc = Null
- Me.txtState = Null
"The Value you entered isn't valid for this field"
when I hit debug it highlights
With Me.txtSupplyRqmtsID = .Fields("SupplyRqmtsID")
From the Edit Command VBA code
What do I need to do to fix this issue so I do not have to close out the form to query and edit another record.
Thanks