Hi guys.
I face one little problem in query. i took some data from access write sql query but some they took data some time not or some time asked null data but i dont know how to put the check basis so please help me about this problem. the query is mentioned below:
using the DAO:
Set rs2 = db.OpenRecordse t("sale")
Set rs2 = db.OpenRecordse t("select sum(foodprice * quatity) from sale where invoice = " & "'" & txtsearch.Text & "'")
If rs2.EOF = True Then
Exit Sub
Else
txttotal.Text = rs2(0)********* *here gve NUll or no database error******
txttotal.Text = Format(txttotal .Text, "####0.000" )
End If
Set rs3 = db.OpenRecordse t("sale")
Set rs3 = db.OpenRecordse t("select discount from sale where invoice = " & "'" & txtsearch.Text & "'")
If rs3.EOF = True Then
Exit Sub
Else
txtDiscount.Tex t = rs3(0)********* *here gve NUll or no database error******
txtDiscount.Tex t = Format(txtDisco unt.Text, "####0.000" )
txttotal.Text = rs2(0) - rs3(0)
txttotal.Text = Format(txttotal .Text, "####0.000" )
End If
so please let me know how to put the correct if else check.
thnx in advance
I face one little problem in query. i took some data from access write sql query but some they took data some time not or some time asked null data but i dont know how to put the check basis so please help me about this problem. the query is mentioned below:
using the DAO:
Set rs2 = db.OpenRecordse t("sale")
Set rs2 = db.OpenRecordse t("select sum(foodprice * quatity) from sale where invoice = " & "'" & txtsearch.Text & "'")
If rs2.EOF = True Then
Exit Sub
Else
txttotal.Text = rs2(0)********* *here gve NUll or no database error******
txttotal.Text = Format(txttotal .Text, "####0.000" )
End If
Set rs3 = db.OpenRecordse t("sale")
Set rs3 = db.OpenRecordse t("select discount from sale where invoice = " & "'" & txtsearch.Text & "'")
If rs3.EOF = True Then
Exit Sub
Else
txtDiscount.Tex t = rs3(0)********* *here gve NUll or no database error******
txtDiscount.Tex t = Format(txtDisco unt.Text, "####0.000" )
txttotal.Text = rs2(0) - rs3(0)
txttotal.Text = Format(txttotal .Text, "####0.000" )
End If
so please let me know how to put the correct if else check.
thnx in advance
Comment