Hi all,
Admittedly, I have not programmed anything in years and Access 2007
seems to have some differences, but I am embarrased to say I can
figure out how to create a multi-field expression in a query that will
provide the following results in a report:
Here is what I want to achieve:
Reorder Alert: If the Physical Inventory is equal to or less than the
Reorder Point then show the Reorder Amount in the report.
This is what I did based on what I read, but it doesn't work. What am
I doing wrong?
ReorderAlert: IIf ([PhysInventory] = or < [ReorderPoint]),
[ReorderAmount]
Thanks!
|
|
0
|
|
|
|
Reply
|
vandersen70
|
4/10/2010 11:11:58 PM |
|
vandersen70@yahoo.com wrote:
>Hi all,
>
>Admittedly, I have not programmed anything in years and Access 2007
>seems to have some differences, but I am embarrased to say I can
>figure out how to create a multi-field expression in a query that will
>provide the following results in a report:
>
>Here is what I want to achieve:
>
>Reorder Alert: If the Physical Inventory is equal to or less than the
>Reorder Point then show the Reorder Amount in the report.
>
>This is what I did based on what I read, but it doesn't work. What am
>I doing wrong?
>
>ReorderAlert: IIf ([PhysInventory] = or < [ReorderPoint]),
>[ReorderAmount]
>
>Thanks!
The syntax is
IIF([PhysInventory]<=[ReorderPoint], TRUE_VALUE, FALSE_VALUE)
--
Message posted via http://www.accessmonster.com
|
|
0
|
|
|
|
Reply
|
PieterLinden
|
4/10/2010 11:28:27 PM
|
|
On Apr 10, 6:28=A0pm, "PieterLinden via AccessMonster.com" <u49887@uwe>
wrote:
> vanderse...@yahoo.com wrote:
> >Hi all,
>
> >Admittedly, I have not programmed anything in years and Access 2007
> >seems to have some differences, but I am embarrased to say I can
> >figure out how to create a multi-field expression in a query that will
> >provide the following results in a report:
>
> >Here is what I want to achieve:
>
> >Reorder Alert: If the Physical Inventory is equal to or less than the
> >Reorder Point then show the Reorder Amount in the report.
>
> >This is what I did based on what I read, but it doesn't work. What am
> >I doing wrong?
>
> >ReorderAlert: IIf ([PhysInventory] =3D or < [ReorderPoint]),
> >[ReorderAmount]
>
> >Thanks!
>
> The syntax is
> IIF([PhysInventory]<=3D[ReorderPoint], TRUE_VALUE, FALSE_VALUE)
>
> --
> Message posted viahttp://www.accessmonster.com- Hide quoted text -
>
> - Show quoted text -
Hi Pieter,
Thanks, put in the expression just as you noted but it is not working.
Get "Data type mismatch in criteria expression" error. Any ideas?
|
|
0
|
|
|
|
Reply
|
vandersen70
|
4/11/2010 12:05:30 AM
|
|
On Sat, 10 Apr 2010 17:05:30 -0700 (PDT), vandersen70@yahoo.com wrote:
>> The syntax is
>> IIF([PhysInventory]<=[ReorderPoint], TRUE_VALUE, FALSE_VALUE)
>>
>> --
>> Message posted viahttp://www.accessmonster.com- Hide quoted text -
>>
>> - Show quoted text -
>
>Hi Pieter,
>
>Thanks, put in the expression just as you noted but it is not working.
>Get "Data type mismatch in criteria expression" error. Any ideas?
What are the datatypes of PhysInventory and ReorderPoint?
This may (probably is) a problem unrelated to the IIF syntax; could you post
the SQL view of the query?
--
John W. Vinson [MVP]
|
|
0
|
|
|
|
Reply
|
John
|
4/11/2010 12:31:39 AM
|
|
On Apr 10, 7:31=A0pm, John W. Vinson
<jvinson@STOP_SPAM.WysardOfInfo.com> wrote:
> On Sat, 10 Apr 2010 17:05:30 -0700 (PDT), vanderse...@yahoo.com wrote:
> >> The syntax is
> >> IIF([PhysInventory]<=3D[ReorderPoint], TRUE_VALUE, FALSE_VALUE)
>
> >> --
> >> Message posted viahttp://www.accessmonster.com-Hide quoted text -
>
> >> - Show quoted text -
>
> >Hi Pieter,
>
> >Thanks, put in the expression just as you noted but it is not working.
> >Get "Data type mismatch in criteria expression" error. Any ideas?
>
> What are the datatypes of PhysInventory and ReorderPoint?
>
> This may (probably is) a problem unrelated to the IIF syntax; could you p=
ost
> the SQL view of the query?
> --
>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0John W. Vinson [MVP]
Hi John,
I checked the data types in the table thinking I may have left some
imported data as text, but these fileds are all integers. Here is the
SQL view:
SELECT Inventory.ID, Inventory.Part_No, Inventory.Description,
Inventory.Type, Inventory.Class, Inventory.Sales_Code,
Inventory.Purch_Price, Inventory.PhysInventory,
Inventory.ReorderPoint, Inventory.ReorderAmount
FROM Inventory
WHERE
(((Inventory.ReorderAmount)=3DIIf([PhysInventory]<=3D[ReorderPoint],"TRUE_V=
ALUE","FALSE_VALUE")));
|
|
0
|
|
|
|
Reply
|
vandersen70
|
4/11/2010 12:38:08 AM
|
|
You are comparing ReorderAmount with either "TRUE_VALUE" or "FALSE_VALUE"
which are both strings.
--
Duane Hookom
MS Access MVP
<vandersen70@yahoo.com> wrote in message
news:2694454d-7841-487b-be6b-97771e2f6701@k33g2000yqc.googlegroups.com...
> On Apr 10, 7:31 pm, John W. Vinson
> <jvinson@STOP_SPAM.WysardOfInfo.com> wrote:
>> On Sat, 10 Apr 2010 17:05:30 -0700 (PDT), vanderse...@yahoo.com wrote:
>> >> The syntax is
>> >> IIF([PhysInventory]<=[ReorderPoint], TRUE_VALUE, FALSE_VALUE)
>>
>> >> --
>> >> Message posted viahttp://www.accessmonster.com-Hide quoted text -
>>
>> >> - Show quoted text -
>>
>> >Hi Pieter,
>>
>> >Thanks, put in the expression just as you noted but it is not working.
>> >Get "Data type mismatch in criteria expression" error. Any ideas?
>>
>> What are the datatypes of PhysInventory and ReorderPoint?
>>
>> This may (probably is) a problem unrelated to the IIF syntax; could you
>> post
>> the SQL view of the query?
>> --
>>
>> John W. Vinson [MVP]
>
> Hi John,
>
> I checked the data types in the table thinking I may have left some
> imported data as text, but these fileds are all integers. Here is the
> SQL view:
>
> SELECT Inventory.ID, Inventory.Part_No, Inventory.Description,
> Inventory.Type, Inventory.Class, Inventory.Sales_Code,
> Inventory.Purch_Price, Inventory.PhysInventory,
> Inventory.ReorderPoint, Inventory.ReorderAmount
> FROM Inventory
> WHERE
> (((Inventory.ReorderAmount)=IIf([PhysInventory]<=[ReorderPoint],"TRUE_VALUE","FALSE_VALUE")));
|
|
0
|
|
|
|
Reply
|
Duane
|
4/11/2010 4:59:04 AM
|
|
If you want to show/hide the value of ReOrderPoint in the query then
SELECT Inventory.ID, Inventory.Part_No, Inventory.Description,
Inventory.Type, Inventory.Class, Inventory.Sales_Code
, Inventory.Purch_Price, Inventory.PhysInventory,
,IIf([PhysInventory]<=[ReorderPoint],ReorderPoint,Null) as Reorder
, Inventory.ReorderAmount
FROM Inventory
If you want to show only those records where the reorder point has been
reached then you don't need a IIF clause at all, just a change to the where
clause.
SELECT Inventory.ID, Inventory.Part_No, Inventory.Description,
Inventory.Type, Inventory.Class, Inventory.Sales_Code,
Inventory.Purch_Price, Inventory.PhysInventory,
Inventory.ReorderPoint, Inventory.ReorderAmount
FROM Inventory
WHERE [PhysInventory]<=[ReorderPoint]
John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County
Duane Hookom wrote:
> You are comparing ReorderAmount with either "TRUE_VALUE" or
> "FALSE_VALUE" which are both strings.
>
|
|
0
|
|
|
|
Reply
|
John
|
4/11/2010 1:30:26 PM
|
|
On Sat, 10 Apr 2010 17:38:08 -0700 (PDT), vandersen70@yahoo.com wrote:
>SELECT Inventory.ID, Inventory.Part_No, Inventory.Description,
>Inventory.Type, Inventory.Class, Inventory.Sales_Code,
>Inventory.Purch_Price, Inventory.PhysInventory,
>Inventory.ReorderPoint, Inventory.ReorderAmount
>FROM Inventory
>WHERE
>(((Inventory.ReorderAmount)=IIf([PhysInventory]<=[ReorderPoint],"TRUE_VALUE","FALSE_VALUE")));
You're comparing a number field ReorderAmount with a text string "True_Value"
or "False_Value". These text strings are not numbers so you'll get this error.
Could you explain what you're expecting? what you're trying to accomplish with
the query?
--
John W. Vinson [MVP]
|
|
0
|
|
|
|
Reply
|
John
|
4/11/2010 11:42:16 PM
|
|
On Sat, 10 Apr 2010 17:05:30 -0700 (PDT), vandersen70@yahoo.com wrote:
>> The syntax is
>> IIF([PhysInventory]<=[ReorderPoint], TRUE_VALUE, FALSE_VALUE)
>>
>> --
>> Message posted viahttp://www.accessmonster.com- Hide quoted text -
>>
>> - Show quoted text -
>
>Hi Pieter,
>
>Thanks, put in the expression just as you noted but it is not working.
>Get "Data type mismatch in criteria expression" error. Any ideas?
What Pieter was suggesting is that you put the value that *YOU* want to use as
the comparison in place of TRUE_VALUE and FALSE_VALUE. It's not clear from
your original post what you want this IIF to do.
--
John W. Vinson [MVP]
|
|
0
|
|
|
|
Reply
|
John
|
4/12/2010 12:44:57 AM
|
|
On Apr 11, 8:30=A0am, John Spencer <spen...@chpdm.edu> wrote:
> If you want to show/hide the value of ReOrderPoint in the query then
>
> SELECT Inventory.ID, Inventory.Part_No, Inventory.Description,
> Inventory.Type, Inventory.Class, Inventory.Sales_Code
> , Inventory.Purch_Price, Inventory.PhysInventory,
> ,IIf([PhysInventory]<=3D[ReorderPoint],ReorderPoint,Null) as Reorder
> , Inventory.ReorderAmount
> FROM Inventory
>
> If you want to show only those records where the reorder point has been
> reached then you don't need a IIF clause at all, just a change to the whe=
re
> clause.
> SELECT Inventory.ID, Inventory.Part_No, Inventory.Description,
> Inventory.Type, Inventory.Class, Inventory.Sales_Code,
> Inventory.Purch_Price, Inventory.PhysInventory,
> Inventory.ReorderPoint, Inventory.ReorderAmount
> FROM Inventory
> WHERE [PhysInventory]<=3D[ReorderPoint]
>
> John Spencer
> Access MVP 2002-2005, 2007-2010
> The Hilltop Institute
> University of Maryland Baltimore County
>
>
>
> Duane Hookom wrote:
> > You are comparing ReorderAmount with either "TRUE_VALUE" or
> > "FALSE_VALUE" which are both strings.- Hide quoted text -
>
> - Show quoted text -
Thanks John Spencer! This did the trick.
Sorry I wasn't more explicit earlier. Like I said, yikes, it's been a
while. Getting my feet wet again.
Appreciate everyone's help.
|
|
0
|
|
|
|
Reply
|
vandersen70
|
4/13/2010 6:11:22 PM
|
|
|
9 Replies
281 Views
(page loaded in 0.136 seconds)
Similiar Articles: calculating multiple fields in an unbound text box - microsoft ...I have a report based on a query that links 2 tables by the field "Type". ... calculating multiple fields in an unbound ... Unbound field calculation save in table - microsoft ... If query/subform is empty set calculation value to 0 - microsoft ...Using a subform, I am summing a field across multiple records, then adding multiple subform totals to provide a single total on the main form. Howev... Multiple results with Count - microsoft.public.access.queries ...... In Access 2003, I am trying to get multiple results in a query using ... be the structure of SQL for this kind of calculation? ... Type an expression like this in the Field row ... Count Records in multiple tables - microsoft.public.access.queries ...... to get a count of Appointments from multiple ... be a string expression identifying a field in a table or query, or it can be an expression that performs a calculation ... Calculating percentage from eneterd values within a table/form ...... value, but not a calculation. You'll need to do that in a query, by adding a calculated field. ... complicated query with multiple tables, and multiple calculations ... how to sum values in multiple fields and put in another ...Running a Query to Obtain One of Multiple Values in a Field ... modifying field values in an Access 2003 ... automatic sum calculation of cell values - microsoft.public.word ... Sum multiple fields on a form using access 2007 - microsoft.public ...> > Just redo the calculation whenever ... How do I sum multiple fields relating to a single field in a form ... Auto calculate sum of multiple fields by record... use a query to ... Unbound field calculation save in table - microsoft.public.access ...... can then set the result to a bound field or execute a query to ... calculating multiple fields in an unbound text ... Unbound field calculation save in table - microsoft ... Calculate field with input from different table - microsoft.public ...Trying to stuff multiple facts into one field is not good database design, not to ... > > Instead, if you need the calculated value, use a query and do the > calculation there ... Median calculation - microsoft.public.access.queries... GoTo Err_DMedian 'Returns the median of a given field in ... I need the query to return something like this: User1 ... one message to all groups at once), rather than multi ... Multi-field query calculations DataBase - DataBase Discussion List ...Hi all, Admittedly, I have not programmed anything in years and Access 2007 seems to have some differences, but I am embarrased to say I can figure out h About calculations in a query (MDB) - Access - Office.comExpressions can perform calculations, manipulate characters, or test data.) into an empty Field cell in the query design grid. The expression can be made up of multiple ... Using multivalued fields in queries - Access - Office.comYou can group by Title and select Count as the calculation for the multivalued field. To create the query, use ... Add or change a lookup column that lets you store multiple ... How to Build a Query in Access With a Calculated Field | eHow.comHow to Perform Calculations in a Query in Access; How to Calculate Elapsed ... Creating a query that uses multiple criteria for a field is like running a filter on your query ... How to Query in Multiple Fields With Access | eHow.comMicrosoft Access is a program included with some versions of Microsoft Office that can be used to manage databases. Access databases consist of tables composed of ... 7/15/2012 3:33:05 PM
|