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
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?
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.
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
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.
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.
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).
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.
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.
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
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?
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?
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.
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.
I have a parameter query built and am curious if anyone knows of a good way to allow the user to define which fields are displayed in the query results.
i tried looking for other threads discussing this without any luck.. not sure if it was my search terms or what. thanks so much for any help..
I am at the last phase of producing an extensive analysis report. The last calculation I need to the query QryCom_CalculationFinal gives me the "Too many fields defined" error. I have verified that "Ps_Score" calculation push the system into overload, as QryComp_CalculationFinalPrt01 without this calculation works fine.
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.
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:
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.
Any way to make the query expired after a defined period but it must remain with that query only not for other queries. Also the query expires should have an option to be alive again or redated for next period after updation means expiry means stop working but not corruption or anything else.
How to retrieve data from a table (via query) ? I created the below query, but I'm not sure what else is needed to retrieve the value from my SQL query. My query code is below. I'm not getting any errors.
Dim strClient As String strClient = "Jerry Davis" strSQL = " SELECT [Progress Tracking].[Client Name], [Progress Tracking].[Client Start Date], [Progress Tracking].[Start Body Weight], [Progress Tracking].[Tracking Date] FROM [Progress Tracking] WHERE [Progress Tracking].[Client Name])= ' " & strClient & " ' " MsgBox "Weight Box " & " " & strSQL
I'm retrieving all **Basecode** column data starts with only letters other than 'W', 'N' by this query
Code: SELECT tbl1.EID,tbl1.Description,tabl1.Basecode FROM tbl1 WHERE Not IsNumeric(Left(Basecode,1)) AND Left(Basecode,1) Not In ("W","N");
And retrieving all **Basecode** if column data length >6 and with numbers '96', '78','54','15' by this query
Code: SELECT tbl1.EID,tbl1.Description,tabl1.Basecode FROM tbl1 WHERE (((Len([Basecode]))>6)AND ((Left([Basecode],2))='15')) OR (((Len([Basecode]))>6) AND ((Left([Basecode],2))='54')) OR (((Len([Basecode]))>6) AND ((Left([Basecode],2))='78')) OR (((Len([Basecode]))>6) AND ((Left([Basecode],2))='96'));
How do i get other data which won't retrieve based on above queries, other than data mentioned on these queries like this
Code: SELECT tbl1.EID,tbl1.Description,tabl1.Basecode FROM tbl1 WHERE (IsNumeric(Left(Basecode,1)) AND Left(Basecode,1) Not In ("W","N")) AND NOT (((Len([Basecode]))>6)AND ((Left([Basecode],2))='15')) OR (((Len([Basecode]))>6) AND ((Left([Basecode],2))='54')) OR (((Len([Basecode]))>6) AND ((Left([Basecode],2))='78')) OR (((Len([Basecode]))>6) AND ((Left([Basecode],2))='96'));
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!