Append query field value, put 0 instead of blank. (1 Viewer)

MushroomKing

Registered User.
Local time
Yesterday, 22:48
Joined
Jun 7, 2018
Messages
100
Hey folks!

Im stuck with this query. I don't fully understand where im making the mistake here.

Some times, the query returns null (blank).
In that case i want the value to be 0.

The part i also dont understand:
It's append query. When i put the default value as 0 in the table it appends to, it doesn't work either.

How can i solve this query, and why does the default dont work in my table?

Thanks in advance!

scanquantity.png
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 13:48
Joined
May 7, 2009
Messages
19,246
yes, use Nz([quantity],0) instead of Nz(scanquantity)
 

MushroomKing

Registered User.
Local time
Yesterday, 22:48
Joined
Jun 7, 2018
Messages
100
Thanks for reply Ranman!

Well, when i put NZ([scanquantity],0) it asks me for parameter when i run it.
When i put NZ([quantity],0) i get an error:


the specified field [quantity] could not refer to more than one table listed

what is happening?
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 13:48
Joined
May 7, 2009
Messages
19,246
then qualify with correct Table name:

NZ([TableNameHere].[quantity],0)
 

MushroomKing

Registered User.
Local time
Yesterday, 22:48
Joined
Jun 7, 2018
Messages
100
Aaaah yes.

Indeed, i have 2 fields with quantity from different tables.
I thought access would figure this out because im telling it from which table.

But this is better :)

Thanks. Next time i will name my fields different in the different tables

Cheers!
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 13:48
Joined
May 7, 2009
Messages
19,246
cheers friend!
 

MushroomKing

Registered User.
Local time
Yesterday, 22:48
Joined
Jun 7, 2018
Messages
100
Ai...not there yet.

Now it says:

Your query does not include the specified expression
Sum(Scanned.quantity)=Nz([Scanned].[quantity],0) as part of an
aggregate function



:confused:
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 13:48
Joined
May 7, 2009
Messages
19,246
firstly, you cannot update an Aggregate query.
if you are not updating it, adding that Expression as Group (Group by Sum(Scanned.quantity)=Nz([Scanned].[quantity],0) may solve the problem.
 

Users who are viewing this thread

Top Bottom