Cuc Tu
08-04-2009, 08:27 PM
I am using VB in Access to write out a file, but in the loop going through each record, if a record contains a blank field, I'd like to either stick some data there or skip the field entirely.
With rst
Do While .EOF = False
strCommand = ![Command]
strDescription = ![Description]
strQuery = ![Query]
strSyntax = ![Syntax]
strParameters = ![Parameters]
strRange = ![Range]
strDefault = ![Default]
strOutput = ![Output]
strExample = ![Example]
.MoveNext
fsoFile.WriteLine "<SCPICommand>" & strCommand
fsoFile.WriteLine "<Heading4>Description<Indented4>" & strDescription
fsoFile.WriteLine "<Heading4>Query<Indented4>" & strQuery
fsoFile.WriteLine "<Heading4>Syntax<Indented4>" & strSyntax
fsoFile.WriteLine "<Heading4>Parameters<Indented4>" & strParameters
fsoFile.WriteLine "<Heading4>Range<Indented4>" & strRange
fsoFile.WriteLine "<Heading4>Default<Indented4>" & strDefault
fsoFile.WriteLine "<Heading4>Output<Indented4>" & strOutput
fsoFile.WriteLine "<Heading4>Example<Indented4>" & strExample
Loop
End With
In this case, not all commands have parameters and the operation stops at
strParameters = ![Parameters]
with the invalid use of Null error.
I thought of an If null, then sort of statement, but can't quite complete the logic of it...
With rst
Do While .EOF = False
strCommand = ![Command]
strDescription = ![Description]
strQuery = ![Query]
strSyntax = ![Syntax]
strParameters = ![Parameters]
strRange = ![Range]
strDefault = ![Default]
strOutput = ![Output]
strExample = ![Example]
.MoveNext
fsoFile.WriteLine "<SCPICommand>" & strCommand
fsoFile.WriteLine "<Heading4>Description<Indented4>" & strDescription
fsoFile.WriteLine "<Heading4>Query<Indented4>" & strQuery
fsoFile.WriteLine "<Heading4>Syntax<Indented4>" & strSyntax
fsoFile.WriteLine "<Heading4>Parameters<Indented4>" & strParameters
fsoFile.WriteLine "<Heading4>Range<Indented4>" & strRange
fsoFile.WriteLine "<Heading4>Default<Indented4>" & strDefault
fsoFile.WriteLine "<Heading4>Output<Indented4>" & strOutput
fsoFile.WriteLine "<Heading4>Example<Indented4>" & strExample
Loop
End With
In this case, not all commands have parameters and the operation stops at
strParameters = ![Parameters]
with the invalid use of Null error.
I thought of an If null, then sort of statement, but can't quite complete the logic of it...