Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

blank as zero

Status
Not open for further replies.

tonyNZ

Technical User
May 14, 2001
8
NZ
hi there (again)

can someone please tell me how when executing a query through a form, to treat blank values as zero

i have a saved query that with Changeto calculates a dollar value that works fine running the query but not when you execute the query from a form unless all dollar fields have a value

Thanks
 
tonyNZ,

You could always run a For loop to write "0" or "Blank" into the empty fields depending on if they are numeric or text fields. Just before the executeQBEFile

Something like the code below might suffice

Var
TC TCursor
EndVar

TC.open("YourTable.db")
TC.edit()
tblName = "YourTable.db"
AlTbl.attach(tblName)
end=AlTbl.nRecords()

for i from 1 to end

if TC."YourField".isblank()=True
then TC."YourField"="0"
EndIf

tc.nextRecord() ; move down one record

endFor




Regards

Bystander
 
tonyZ,

Slight adjustment to my earlier post

Var
TC TCursor
end longint
AlTbl Table
EndVar

The rest stays the same.

Apologies

Bystander
 
Thanks Bystander

All AOK now

much appreciated

TonyNZ
 
You could always toss a 'not blank' into the original query to skip the records with blank dollar values too.

Mac
:)
mailto:langley_mckelvy@cd4.co.harris.tx.us
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top