Function chk1(A As Variant) As Boolean 'Check date Dim i As Integer, l As Integer, c As String A = Trim(A) 'remove possible spaces chk1 = False If IsNull(A) Or IsDate(A) Then chk1 = True End Function
Private Sub cmd_UpdateCheckFields_Click() Dim MyDB As DAO.Database Dim MyRst As DAO.Recordset Set MyRst = CurrentDb.OpenRecordset("tbl_TEMP_RFI") MyRst.MoveFirst Do Until MyRst.EOF MyRst.Edit MyRst![chk_ProductInfo_NDC] = chk0(MyRst![ProductInfo_NDC]) MyRst![chk_ProductInfo_ExpectedLaunchDate] = chk1(MyRst![ProductInfo_ExpectedLaunchDate]) MyRst![chk_ProductInfo_PkgSize] = chk2(MyRst![ProductInfo_PkgSize]) MyRst.Update MyRst.MoveNext Loop MyRst.Close Set MyRst = Nothing End Sub
but this code only seems to work when the field is evaluated on a form and not within a table as the above code is doing.
If IsNull(A) Or IsDate(A) Then chk1 = True
Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.
”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.