PDA

View Full Version : Numeric VS Character in Bris Single Data


douglasw32
03-13-2011, 08:16 PM
Before I go through the data file structure FAQ and make a giant if then statement to put "" (Quotes) around character fields and none around numeric fields when reproducing the file as a CSV export.

Does anyone all-ready have this criteria pulled apart ?

I am using VB6 and the IsNumeric handle does not do the job since things like program number appear to be numeric but are set as character in the file structure.

Jeff P
03-13-2011, 08:53 PM
Doug, you might find something like the following public function useful:

Public Function handleValuesFromFile(varValuePassedIn)

Dim varReturnValue As Variant


'Determine VarType of argument passed in by the caller
'and act accordingly.
Select Case VarType(varValuePassedIn)

Case 2
'argument passed by the caller is an integer
varReturnValue = Int(varValuePassedIn)

Case 3
'argument passed by the caller is numeric long
varReturnValue = CLng(varValuePassedIn)

Case 4
'argument passed by the caller is single precision numeric
varReturnValue = CSng(varValuePassedIn)

Case 5
'argument passed by the caller is double precision numeric
varReturnValue = CDbl(varValuePassedIn)

Case 6
'argument passed by the caller is currency
varReturnValue = CCur(varValuePassedIn)

Case 17
'argument passed by the caller is a numeric byte
varReturnValue = CByte(varValuePassedIn)

Case 8
'argument passed by the caller is a string
varReturnValue = CStr(varValuePassedIn)

Case Else
'argument passed by the caller has not yet been handled
varReturnValue = varValuePassedIn

End Select


'set function return value
handleValuesFromFile = varReturnValue

End Function





VarType() VB6.0:
http://www.chennaiiq.com/developers/reference/visual_basic/functions/vartype.asp




-jp

.

douglasw32
03-14-2011, 10:03 PM
Thanks that helped