I have written a query to produce the result of two rows which have been subtracted from each other, what i want to do is display a form or dialogue when on the reults is a 0 or a minus figure
This is how I do it. If i open a form based on (for example) a query, before displaying the form i will run the sql in code using DAO and if the recodset returns 0 rows then cancel opening the form.
Eg.
dim db as database
dim sSelect as string
dim rs as recordset
set db = currentdb
sSelect = "Select fields from table where etc etc"
' where sSelect is the exact SQL that your form is based.
set rs = db.openrecordset(sselect,dbopendynaset)
if rs.recordcount<1 then
' No records returned
docmd.openform "form"
else
docmd.openform "other form"
end if
I think this is the code. You may have to tweak it and correct any syntax problems.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.