Queries :: User Defined Criteria On Percent Field?

May 7, 2013

I have a a table that stores various financial information such as sales receipt totals and variance totals (if actual cash in drawer did not match receipts, etc...) that I use to track cashier performance and identify possible problems. Part of this process includes a query that I pull reports against.

One such query, simplified to illustrate the concept, lists the dollar total that their receipts indicate they made, and the dollar amount that their actual drawer was off (either short or over what they should have taken in.) In this query I added fields that total Netsales (calculated from the first two fields) and another that calculates the percentage the variance is compared to their NetSales. The SQL behind the query is as follows:

Code:

SELECT tbl_OSRImport.Receipts, tbl_OSRImport.OverShort, [Receipts]-[OverShort] AS NetSales, [OverShort]/[NetSales] AS VarPerc
FROM tbl_OSRImport
WHERE (((tbl_OSRImport.OverShort)<>0) AND (([Receipts]-[OverShort])<>0));

This query works just fine. The calculated fields correctly display their results. The issue presents itself when I try to build a method for a user to run a report to see all the cashiers whose Varience Percentage (VarPerc) is equal to or within a range they specify. This allows the user to see all the cashiers who, for example, are more that 5% over or short. I have tried a number of criteria expressions in the query, with no success. I have gotten everything from a prompt asking me for paremeters to an error stating "Stack Overflow." I believe the problem has something to do with the fact that the numerical value that is calculated is a long string of numbers ending in letters and characters, which the Query displays as a neat and tidy Percentage. Below is an example of the data that I hope will explain this:

In the Query, the expression is: VarPerc: [OverShort]/[NetSales]

When the Query runs, the full numerical result is: -4.27103159497526E-02

Which visually is output as: -4.72%

Mathmatically (on a calculator using the same values) the equation is as follows:

-11.22 / 262.70 = -0.04271032

I think my attempts are failing becaue the query is trying to compare the user's input of (for example) 5, .5, .05, etc.... against the numerical value in the query result that includes the E-02 (above example.) So, rightfully it comes back with no results or an error.

View Replies


ADVERTISEMENT

Queries :: User Defined Criteria For Number Field

May 28, 2015

Query that I have built to create a subform on one of my forms. It's my goal to make the subform easily navigable/query-able for the users, and that is where I've hit a roadblock. The subform contains a field - Balance - which I would like users to be able to search based on numeric/mathematic expressions (i.e. >0 and <40). In testing I have created a text box on the main form (BalanceCriteria), and linked it to the subform's balance field through the query in the Criteria field (forms!MainForm!BalanceCriteria).

This works fine with exact numbers - entering 19 will return client's with a balance of 19 - but returns an error - "Expression is typed incorrectly or is too complex to be evaluated" when tested with a numeric equation (>0).

View 3 Replies View Related

Queries :: Include Date Criteria In User Defined Function That Calculate End Of Current Month

Jul 22, 2014

I have written a user defined function that calculates the end of the current month. This I named EndOfThisMonth. It works well as a function. Now I would like to use it as date criteria to include in a query. The function is included as such EndOfThisMonth().

The field on which this function is to enter as a criteria is another calculated date function called Due.

When I run this query I get an error message saying Undefined Function 'EndOfThisMonth' in expression.

View 3 Replies View Related

Is It Possible To Choose No Criteria On A User-defined Criteria Form?

Sep 15, 2005

I created a form that allows the user to choose the criteria that they want to see on a report using =Forms!formname!controlname in my query. It works great but I want to also allow the user to choose nothing and return all records instead of limiting them to choose just one type of record. Is this possible? Before I created the form my query had the [Enter parameter] on one criteria line and [Enter parameter] Is Null on the next criteria line and that was working great for my use but I need to create a simple form for other users.

View 1 Replies View Related

Modules & VBA :: Compile Error - User-defined Type Not Defined

Apr 20, 2015

I copied some VBA from one database to another. I didn't change anything and I am able to run it fine in the first database. But in the DB I pasted it to, I am received a Compile Error message with the XlApp As Excel.Application area highlighted.

Function OpenAutoCount()
Dim xlApp As Excel.Application
Dim xlWB As Excel.Workbook

[code]...

View 3 Replies View Related

General :: ADODB Connection - User Defined Type Not Defined

Feb 10, 2014

I have a line of code in an old program:

Dim CN as ADODB Connection

This is giving me the error 'User defined type not defined'. I know I have to set something in a list somewhere but have forgotten how to do that. Where to go, and what to set?

View 1 Replies View Related

User Defined Date In Queries

Apr 17, 2008

Hello all, im new here so hi to everyone.

Im stuck! I am pretty much a novice when it comes to access and have been given the task or creating some reports to stop us doing it manually.

Within a query, I have a date column which we would currently enter the following into the criteria:

Between #01/01/2008# And #31/01/2008#

for the month of January.

What i want to be able to do (and i know is possible as ive done it in the past but cant remember how) is have a pop up when the query is ran to enter the Start date and End date. I remember it being something to do with square brackets but cant get it to work.

Help please! lol

View 14 Replies View Related

Queries :: Can Retrieve Value Of User-defined Type In A Query

Aug 19, 2013

Is there a way to retrieve the value of a user-defined type in a query?

Here's the type:

Code:
Public Type ClassRank
Rank As Integer
ClassCount As Integer
End Type

I have a function with the following excerpt:

Code:
Function GetRank(strDOD) as ClassRank
...
GetRank.Rank = intRank
GetRank.ClassCount = intCount
...
End Function

In my query I expected to be able to put the following:

Code:
GetRank(strDOD).Rank & " " & GetRank(strDOD).ClassCount

However, Access didn't like the period in .Rank or .ClassCount.

Should I just write two different function to get 'rank' and 'classcount'?

View 2 Replies View Related

Error - User Defined Type Not Defined

Nov 9, 2005

Hi,

On Compiling my assecc database VB code I get the following error message "User defined type not defined". I understand it is beecause I have not declared the Variable Type, but have no idea to exactly which part of the code the error is referring to.

How do I find out WHICH User defined type is not defined, especially when I have not got any (or do not want to use any) user defined types?

Thank you in advanced programming wizards. Kind regards, Adam.

View 14 Replies View Related

User Defined Parameter Queries / Forms Major Problems !!

Oct 25, 2006

Good Morning

Looking for the user to select a product name from a drop down box (not type in) when running query / report which will return details on only that product rather than all others in the query.

I have got major problems with the custom dialog boxes -- have got a table of product names, a query called current stock ( active products) . I can easily get a standard dialog box by putting [product code] in brackets in the query and this is not a problem. However in getting a custom dialog box I have had lots of problems.

Created a form called form999 which has product name field as a combo box and this has been named master1 . Clicking the form on it's own brings up the dialog box correctly and the drop down box selects the current products which is should do.
However linking it to the query I have put [Forms]![form999]![master1] in the query and it will not link unfortunately and is driving me mad.
Upon running the query it simply brings up the standard dialog box with [Forms]![form999]![master1] as the "enter parameter value. Understand code is required to get the OK and cancel macros working etc but when I click the query it should bring up the custom box which is the first stage and it is not ?? Any assistance would be greatly received.

Are there any sample DBs which have a field or related parameter as a customer dialog box -- have looked for examples without success.

many thanks and regards
Ian Watson Yarm UK

View 2 Replies View Related

Queries :: Crosstab Query - Formatting User Defined Columns

Jul 24, 2013

I am making a classic sales over time crosstab query.

Rows: Customers
Columns: Sale months

Sales date is defined by the ETD of the order.

However, with the simple Format([ETD],"yyyy-mm") I get regular months, but I need to adjust the months to be between the 21st and 20th rather than 1st to 31st(30th).

August would be 7/21/2013 to 8/20/2013
September 8/21/2013 to 9/20/2013

Is it possible to format the columns this way?

View 2 Replies View Related

Queries :: Show User ID When There Are No Errors During Defined Time Frame

Apr 16, 2014

I have an error database that I'm attempting to build. I need the results of the query to show User ID when there are no errors during a defined time frame.

View 9 Replies View Related

User-defined Type Not Defined

Oct 15, 2004

Dim XL As Excel.Application

When I try to run this specific line of code an error occurs. It says:
"User-defined type not defined"

May I know how to solve this problem?
Thanks a lot

View 1 Replies View Related

User-defined Type Not Defined

Sep 27, 2005

I've put in this in a module many times and this is the first time I have gotten an error.

Dim Conn As ADODB.Connection

When I run the app I am getting a compile error saying "User-defined type not defined".

Anyone have any ideas?

Thanks,

B

View 3 Replies View Related

Queries :: Direct Input To A Field Which Is Defined Source From Query

Sep 4, 2013

I got a field which is defnined based on a query result to ease the user input. However, some input are not in the query list, if I input data directly to the field, ACCESS complained I must choose item from the query result. Is there any way that the user can either select from query result or direct input to that single field?

View 1 Replies View Related

Tab Order - User Defined

Jun 16, 2005

Has anyone ever produced a function to let users, pick their own tab order for a form.

I am thinking along the lines of holding a tab order for each user for each form.

So when a form opens - if a user has saved a tab order the form will adopt it, if the user has never saved a tab order, the sytem default will be applied.

Would this work.

Paul

View 4 Replies View Related

User Defined Autonumber

Oct 31, 2005

Can anyone help?

Is it possible to have an autonumber that is generated depending on the entry in a particular field? I'm creating a database to track various enquiries and I would like each enquiry to have a unique number that is preceded by a codenumber that identifies its origin. For example:

ABC query - 100xxx
DEF query - 200xxx
XYZ query - 300xxx

(xxx denotes the autonumber part)

This way a particular query can be identified just from its number without having to interrogate the main record.

Can it be done? I've searched other posts and not found quite what I'm looking for.

(If not then no probs - I'll think of another way!)

Thanks in advance

View 2 Replies View Related

User Defined Query

Sep 2, 2004

I have a combo box that the user can select a value and the form will display that record on the form. This all works fine, but if the user dosn't enter anything in the combo box, it does not work. Is there a way to have it work if the combo box is left empty?
Thanks in advance - John

View 1 Replies View Related

User Defined Tables

Nov 2, 2004

I am trying to get the list of all user defined tables from the Access database.

If I use the following query in Access it's working fine and getting the result. But if I am trying to execute the query in ASP page, it's not working. I am getting an error ([Microsoft][ODBC Microsoft Access Driver] Record(s) cannot be read; no read permission on 'MSysObjects'.)

Can u please tell me the reason.


SELECT MSysObjects.Name AS TableName
FROM MSysObjects
WHERE (((MSysObjects.Type)=1)
AND ((MSysObjects.Flags)=0));

Note: If you have anything, to extract user defined tables, please tell me. Either one works out for me.

View 3 Replies View Related

User Defined Dates Into A Report

Oct 3, 2006

HI,

I have a query [CustomerOrdersByDate] that requests user input for [CustomerID], a 'Start Date' and an 'End Date' for the [OrderDate] field.

the Report works fine, however I'd like it to be able to take the Start & End dates the user has inputted when running the report, and make it appear in the Report header
e.g. Orders Received from [CustomerID], Between {user defined}[Enter Start Date] And {user defined}[Enter End Date].

I have added a text box to display the results and played around with a few different expressions, etc... unsuccessfully so far, and as I'm not up to working with VBA code, I would appreciate some help!

View 2 Replies View Related

User Defined Query/ Report

Feb 7, 2008

Hello,

Is there any way of creating a user defined query/ report based on fields in a table? Basically we want a report to be generated based on whatever fields the user enters. So, say we have 30 different fields in a table, the user gets to click on a button that gives them the option to create a report that includes: field1, field2, field3 and where field10 = Blue.
Is this possible to do?

View 1 Replies View Related

User Defined Date Query

Apr 16, 2008

I want to run an activity query (i.e. objective is to check which data lines have changed) within a user defined date range. Please advise what is the most efficient way to achieve this.

Is it possible to run such a report without having a date column i.e. does Access have a hidden line modification date that can be used in a search?

Look forward to your feedback - thanks!

View 2 Replies View Related

Creating Reports From 3 User Defined Critera

Nov 16, 2004

Please advise, how do I set up a form for this:

Based on one particular report style, have multi select criteria to produce user selected criteria

based on selections from a. Interest, b. State, c. Type

Report 1. sorts on Interest, 2. sorts by State, 3. sorts by Type ... and each report includes selections of the other 3 selections plus basic data common to all.

Plus, the Interests have a table where the main interest data is stored in a ContactInterest table, while the specific interest selections, per contact, are stored in the Contact table as Interest_1 through Interest_20.

In the Report, when it is sorted by Interest, while I have a concantated output for 5 of the selections, they also, want to sort alphabetically by the interest selections (which changes per Contact).

There is already a form for printing reports that are more static, and I wanted to add these selections on that form, perhaps as a subform, to allow printing of the reports, mentioned, and associated mail labels to the targeted addresses per group.

Any help, direction, guidance, or redirection would really help and is MUCH appreciated. I've tried many options, and as a newbie, have not yet found a solutions- or solutions.

Thank you so much. (time is of the essence and my skills are small so far.)

__________________

View 1 Replies View Related

General :: Saving User Defined Variables

Sep 16, 2012

I have a database that creates many forms based on queries which are based on user-defined variables. These are permanent variables added directly in the query, such as "if an employee is late 4 times in a month, we yell at them." I would like to be able to change this to "5 times in a month" if the users want to.

Rather than waiting for that to happen and having to change all my queries, i want to set up a form for them to access and edit the variable, save it, and then my queries to reference that variable.

My question is what is the best way to store and reference them? I could create a table, but i am not too sure how easy it would be to make my queries work with that.

I could also add them onto my main form which is always open, but I'm not sure how to make them save when access is closed. (a quick trial from my variable form won't let me update either a text box or label value on the main form).

View 5 Replies View Related

User-defined Datatype In A Sql Server Attached Tables

Dec 5, 2006

Hi all,I'm trying to attach some table from a Sql Server database, but when I take a look to the content, I see all the fields filled by the value "#CANCELLED".I supposed that the matter of such an issue could be the datatype used for some fields, a user-defined datatype. The only table content from the same Sql Server database I can see does not use that data type. I'm using a read-only account to access the Sql Server database. If I try to import the table, the data are imported correctly and the user-datatype is converted to text.Any suggestions for a solution / workaround ?Thanks Bye

View 4 Replies View Related

User Defined Types/public Function In A Query

Oct 29, 2007

Hi All

I have used Allen Browne's code (see http://allenbrowne.com/ser-16.html, bottom of page) as a model for my user-defined type and public function in an events management database.

Using the function in forms/VBA works fine.

But my DB crashes whenever I try to use it in a query.

My modules code:
= = =
Option Compare Database

Public Type EvCheks
EvType As String
EvAttCat As String
EvUnitAss As String
EvCheksAll As String
End Type
= =
Public Function getEvCheks(EV, EvUnit) as EvCheks

'Event Type: Event or DL
If (DLookup("evtype", "tblevents", "[evid] = " & EV)) = "Event" Then
getEvCheks.EvType = "Y"
Else: getEvCheks.EvType = "N"
End If

'Event Attendance Category: INDB= in database or LIST
If (DLookup("evattcat", "tblevents", "[evid] = " & EV)) = "INDB" Then
getEvCheks.EvAttCat = "Y"
Else: getEvCheks.EvAttCat = "N"
End If

'Event Assessing Organisation
Dim AOROName As String
Dim AOName As String
AOROName = DLookup("evunitassessable", "tblevunits", "[evunitid] = " & EvUnit)
AOName = Mid([AOROName], 1, InStr([AOROName], "/") - 1)

Select Case AOName
Case "NA"
getEvCheks.EvUnitAss = "N"
Case "ABCD"
getEvCheks.EvUnitAss = "Y"
Case Else
getEvCheks.EvUnitAss = "X"
End Select

getEvCheks.EvCheksAll = getEvCheks.EvType & getEvCheks.EvAttCat & getEvCheks.EvUnitAss
End Function
====
On a form, I have a button with on-click event code that defines the EV and EVU variables and displays a message box
MsgBox getEvCheks(EV, EVU).EvCheksAll

This works fine.
=====
In a query I have this SQL code:
SELECT tblEvUnits.EvId, tblEvUnits.EvUnitID, getevcheks([evid],[evunitid]) AS EventDetails
FROM tblEvUnits;

This causes the db to crash.

I cannot get the "back-end" definition of the function into the query, as Access rejects it because of the dot, i.e. ".EvCheksAll".

I suspect there is some formatting quirk for using a public function that includes a user-defined type, in a query.

Any/all assistance much appreciated.

Regards
AlanM

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved