tranchemontaigne
Registered User.
- Local time
- Yesterday, 17:42
- Joined
- Aug 12, 2008
- Messages
- 203
CAVEAT: I have some very poor quality data to work with.
GOAL: Run a series of data quality checks and edits against every field before a "cleaned" record can be INSERTed into a "cleaned" data table.
METHOD:
(1) Assign a variable for every data field in "cleaned" data table
(2) Build a recordset of raw data
(3) Evaluate each field against a set of coded edits
(4) Based upon a test for "null" values, build a dynamic INSERT statement
NOTE: this dynamic statement will build the INSERT INTO clause and the VALUES clause based upon the actual number of fields with values
(5) Loop through recordset to the next record until EOF has been reached
PROBLEM CODE:
(Code fails at row #2 in this snippet when rst1![t13_No_Students_Absent].Value = null)
QUESTION: Variant datatypes are designed to store null values. What should I do to set a variant variable equal to a recordset element that stores a null value?
Any assistance would be appreciated.
________
XR125L
GOAL: Run a series of data quality checks and edits against every field before a "cleaned" record can be INSERTed into a "cleaned" data table.
METHOD:
(1) Assign a variable for every data field in "cleaned" data table
(2) Build a recordset of raw data
(3) Evaluate each field against a set of coded edits
(4) Based upon a test for "null" values, build a dynamic INSERT statement
NOTE: this dynamic statement will build the INSERT INTO clause and the VALUES clause based upon the actual number of fields with values
(5) Loop through recordset to the next record until EOF has been reached
PROBLEM CODE:
(Code fails at row #2 in this snippet when rst1![t13_No_Students_Absent].Value = null)
If IsNull(rst1![t13_No_Students_Absent].Value) = True Then
varNo_Students_Absent = Null
ElseIf Trim(rst1![t13_No_Students_Absent].Value) = "" Then
varNo_Students_Absent = Null
Else
varNo_Students_Absent = CLng(Mid(rst1![t13_No_Students_Absent].Value, 19, 30))
End If
QUESTION: Variant datatypes are designed to store null values. What should I do to set a variant variable equal to a recordset element that stores a null value?
Any assistance would be appreciated.
________
XR125L
Last edited: