if Qty Value is zero or less than (1 Viewer)

mabino79

Member
Local time
Today, 16:26
Joined
Nov 17, 2021
Messages
72
is there a way to do

if Qty Value is zero or less than, the row from the report should be deleted or hide.
 

June7

AWF VIP
Local time
Today, 02:56
Joined
Mar 9, 2014
Messages
5,423
Apply filter opening report.

DoCmd.OpenReport "reportname", , , "Qty>0"
 

mabino79

Member
Local time
Today, 16:26
Joined
Nov 17, 2021
Messages
72
Apply filter opening report.

DoCmd.OpenReport "reportname", , , "Qty>0"
where to write the code, in Report opening button or in a module
 

June7

AWF VIP
Local time
Today, 02:56
Joined
Mar 9, 2014
Messages
5,423
I would think button click event.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 18:56
Joined
May 7, 2009
Messages
19,169
you can also put it in your report's Recordsource:

select * from yourTable where Nz(qty, 0) > 0
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 06:56
Joined
Feb 19, 2002
Messages
42,970
But why would you ever want to use a macro? Please don't answer. The question was rhetorical.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 05:56
Joined
Feb 28, 2001
Messages
26,996
Now Pat, you KNOW that macros are the gateway drug of choice on the road to a full-blown VBA habit. ;)
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 06:56
Joined
Feb 19, 2002
Messages
42,970
@oleronesoftwares I said the question was rhetorical and didn't need a response. June's solution was perfectly adequate. I would generally do it using the method arnel recommended but I didn't offer that suggestion since June's was fine. Did you not think either of those methods was adequate? If you disagree with solutions posed by others, please feel free to comment and tell us why your solution is better. Unless I had a problem with the first solution (which I didn't ) or thought it needed additional information (which I didn't) I wouldn't have jumped in here at all. I only came in because confusing an OP with multiple "good" answers isn't actually helpful. I don't think this is a contest but maybe I missed something and there is a prize (money I hope). In which case, I missed my chance. I could have beat arnel and posted his solution ahead of him because I saw the thread before he did. But I didn't. Why confuse the issue when a useful answer had already been posted?

Sometimes the OP has trouble understanding the first workable solution. If he does, then maybe he would understand or be able to implement a second or a third more easily. but others might want to also take a deep breath and hold your fire unless further help is needed or you think there is something wrong with the original suggestion.

Cute Doc;) My problem is that I came to Access already knowing how to code and now, 25 years later, I still find the logic of macros completely mystifying. My only macros are lists of simple instructions with NO logic involved. Do this, that, and the other thing. No deviations!
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 05:56
Joined
Feb 28, 2001
Messages
26,996
Just to be serious for a moment, Pat, don't forget that for novices, Macros make more sense because they emulate ribbon-based actions. The fact that Access has a way to convert a lengthy Macro into VBA code just means that the Macro can be your quick-n-dirty method to get started and then come back later to clean it up. Which I must admit to having done more than once as a way to get something up fast and then fix it (via conversion) for version 2.
 

Users who are viewing this thread

Top Bottom