Queries :: Semicolons As Parameter Separator In Functions

Sep 8, 2014

I used to use commas as a parameter separator, but for some reason it is now a semicolon. How can I change it back to a comma?

Currently this works:

Code:
SELECT IIF(MyExpression; TrueThing; FalseThing)
FROM ...

Want to use (and have used before):

Code:
SELECT IIF(MyExpression, TrueThing, FalseThing)
FROM ...

View Replies


ADVERTISEMENT

Queries And Functions

Mar 20, 2007

Hi,

I need some help with a function inserted into a query.

I created a function to convert numbers into text. I then created a query to pull some fields from a table. the last field of the query, I inserted the function using the build feature. I was able to see the function in the list of custom functions for the query.

However, when I run the query I get an error message of undefined function - name-. Can I use my function there? or is there some other way to do so.

thanks for any help received.

Regards,

CathyM

View 2 Replies View Related

Queries And Functions Help

Aug 25, 2006

hi,
what im trying to do is use the code below, coupled with a append query, to
make the value of the 'lag' variable go into the feild in 'tblplayer' 'Lowes
t_age_group"

can anyone see what im doing wrong?

thanks
any help would be much apreciated

Nick


Public Function fnlag()


Dim cutof As Date
Dim age As String
Dim Birthdate As Date
Dim age1 As String
Dim lag As String

cutof = DLookup("[cutoff]", "[tblseason]", "[tblseason].[is_current] = -1")
Birthdate = DLookup("[Birthdate]", "[tblplayer]")
lag = 1
lag = DLookup("[Lowest_age_group]", "[tblplayer]")

age = DateDiff("yyyy", Birthdate, cutof, vbMonday, vbFirstJan1)
'MsgBox (age)
lag = age + 1

End Function

View 1 Replies View Related

Functions Work In Code But Not Queries

Feb 14, 2007

I have a problem where I can create queries in code using functions such as Left() and they will work fine on my clients machines with a complied MDE file but if I try to use the same function in a saved querie they get an error: "Function is not available in expressions in query expression..."

The Queries work fine on my machine but not on those using Access Runtime. From my research it appears to be a problem with them not having the correct Reference on their machine. If that is true then which Reference do they need and is there away of installing that Reference by code?

Thanks for your help....

View 1 Replies View Related

Functions In Queries / Expression Builder

Dec 3, 2004

Hi, I need some help using functions in queries. I can calculate simple arithmetic in calculated fields, but fail when using functions. For example I have attached a doc file showing a query. One table displays record ids, the other four have data for consecutive dates for each record. I cannot make the query calculate the standard deviation of the data for each record. What expression would I use, I know it is stdevp but when i try and create the expression i get error messages galore.

thanks

View 2 Replies View Related

Queries :: Aggregate Functions With Conditions?

Mar 22, 2013

I have the following query. I got an error when I ran it.

Code:
SELECT COUNT([encounter_number] WHERE status = 'Death')/ COUNT([encounter_number]) AS Death Ratio, tbl_test.facility_type AS Type,
FROM tbl_test
GROUP BY tbl_test.facility_type;

I think the problem is that first WHERE clause inside.

View 2 Replies View Related

Queries :: IIF Statement With Date Functions

Feb 24, 2014

My goal is if the current date = 1st - 4th of the month to return the failure_date if it is >= 1st of the prior month and <= 4th of the current month (ie, 01/01/14 - 02/04/14)

this works:
>=DateSerial(Year(Date()),Month(Date())-1,1) And <=DateSerial(Year(Date()),Month(Date()),4)

But if the current date > 5th of the month to return the failure_date if it is >= 1st of the current month and <= 4th of the next month.(ie 02/01/14 - 03/04/14)

this works
>=DateSerial(Year(Date()),Month(Date()),1) And <=DateSerial(Year(Date()),Month(Date())+1,4)

But when I put it in the iif statement if will not work:

IIf(Date()>DateSerial(Year(Date()),Month(Date()),4 ),>=DateSerial(Year(Date()),Month(Date()),1) And <=DateSerial(Year(Date()),Month(Date())+1,4),>=Dat eSerial(Year(Date()),Month(Date())-1,1) And <=DateSerial(Year(Date()),Month(Date()),4))

SQL =
SELECT table_testing_dates.Failure_Date, table_testing_dates.Failure_Date, table_testing_dates.FailureGrouping
FROM table_testing_dates
WHERE (((table_testing_dates.Failure_Date)=IIf(Date()>Da teSerial(Year(Date()),Month(Date()),4),(table_test ing_dates.Failure_Date)>=DateSerial(Year(Date()),M onth(Date()),1) And (table_testing_dates.Failure_Date)<=DateSerial(Yea r(Date()),Month(Date())+1,4),(table_testing_dates. Failure_Date)>=DateSerial(Year(Date()),Month(Date( ))-1,1) And (table_testing_dates.Failure_Date)<=DateSerial(Yea r(Date()),Month(Date()),4))));

View 2 Replies View Related

Troubles With Aggregate Functions In Queries And Null Values

Jun 26, 2007

I'm having a problem with queries, and I can't seem to find a solution in books - I looked through about ten of them and none of them addressed the problem. This may be because it has a painfully obvious solution...

A little background:
I am designing a database for a debt-collection law firm. One of the functions it must have is to keep track of various different sorts of financial transactions which can pertain to a given debtor (ie, a received payment, a cost expended, and a few other things).

The problem is that, in generating reports, I need to use queries to find several sums of only those transactions which fall into specific categories (for instance, to calculate the amount a debtor has paid against his balance, it needs to sum only those entries which are both linked to that debtor's ID number and whose type field reads "payment", and then subtract from that those entries whose type field reads "cost"). The problem is this: not all debtors may have "costs" entries, and when there are none, the report comes up blank with a single "#Error" written in the name field and nothing else present.

I believe the problem is that the Sum aggregate is returning a null value when the query finds nothing that meets the criteria. I have been unable to find a way around this; the Nz() and IIf() with IsNull() functions don't seem to be helping.

The query runs as intended when there are entries for every relevant type; however, it is undesired to have to enter a "payment" of $0, "cost" of $0 etc for every entry just so that this function works.

Is there anything I can do about this? Any input would be appreciated, as I'm fairly inexperienced with the use of Office Access. (If it matters, I am using Office 2003).

View 2 Replies View Related

Queries :: IIF Functions - Control Source Of A Field In Form Data

May 8, 2014

I am new to access, after learning basics I am trying to build my first DB.

Having some troubles with the IIF syntax. I am placing the formula

=IIf([Total]<=(200),[Total]*(0.7)) & IIf([Total]>(201)&[Total]<=(500),[Total]-(200)*(1)+(140)) & IIf([Total]>(501),[Total]-(500)*(1.2)+(300)+(140))

In the form data control source of a field. The first 2 statement seems to work, but the last statement results in some crazzy figures.

View 3 Replies View Related

Queries :: Applying Multiple Count Functions With WHERE Criteria Without Affecting Others

Dec 11, 2013

Any way to use multiple count functions in a query with their own individual filters without affect the others?

For example:

SELECT [E&I Table].System, [E&I Table].DeleteRecord, Count([E&I Table].[Status#1]) AS [CountOfStatus#1], Count([E&I Table].[Status#2]) AS [CountOfStatus#2]
FROM [E&I Table]
WHERE ((([E&I Table].[Status#1]) Like "ITR Rcv'd by QA" Or ([E&I Table].[Status#1]) Like "Completed" Or ([E&I Table].[Status#1]) Like "Ready for T/O" Or ([E&I Table].[Status#1]) Like "Reviewed by JVV") AND (([E&I Table].[Status#2]) Like "ITR Rcv'd by QA" Or ([E&I Table].[Status#2]) Like "Completed" Or ([E&I Table].[Status#2]) Like "Ready for T/O" Or ([E&I Table].[Status#2]) Like "Reviewed by JVV"))
GROUP BY [E&I Table].System, [E&I Table].DeleteRecord;

I am trying to count in each column of the E&I table with criteria using WHERE but the problem is when you have more than 1 WHERE it affects the other columns as well... tried a bunch of different ways and I am now having to create seperate Queries than combine them using another Query...

View 6 Replies View Related

Reports :: Changing Character Separator

Jul 16, 2015

I'm working on a report in Access 2013 and I have a multivalued field that stores employees names in the format "Last, First" and when I put it on my report it displays all the names as "Last1, First1, Last2, First2, Last3, First3" and so on. That's a lot of commas and it was suggested to me by my boss that I change access to use semicolons between the employees as he would like to keep the names as Last, First.

View 7 Replies View Related

Forms :: Number Separator In Subform

May 15, 2013

I needed to change the decimal symbol from a dot to comma for use in Europe. On changing the the settings to a comma everything works fine but for the field that I have the code in the AfterUpdate properties

Private Sub SprayCfuelC_AfterUpdate()
Me.Dirty = False
CurrentDb.Execute ("UPDATE ProcessData SET ProcessData.SprayCFuelC =" & Me.SprayCfuelC & " WHERE (((ProcessData.AuditNo)=" & Parent.[AuditNo] & "));")
Me.Recalc
End Sub

Now when the data is changed I get a run time error 3144 - syntax error in UPDATE statement.

View 5 Replies View Related

General :: How To Remove Date Separator

Jul 16, 2012

I have a lot of dates in one column (dd/mm/yy), and i somehow need to duplicate them into another column where they are shown without the date separator (ddmmyy), so that i can use that figure in a future calculation where a variety of fields are combined to show one unique product number.

View 7 Replies View Related

Military Time - No Colon Separator For Key Entry

Mar 15, 2014

We have a new contractual requirement to track all time spent on Military contracts and report it to our Prime Contractor annually.

I am trying to put into Access 2010, basically the same functionality that I have built into Excel time sheets for years; that is simple entry of time in military time using 3 or 4 keystrokes depending on the time of day.

I have a table which records an employee's employee number and job that he or she is working on. I have formatted fields to short for Start Time and Stop Time, and I have a Calculated field also formatted short for elapsed time, however I need to have it simplified to where there is no colon separator on key entry in the form to 700 for 0700 hrs military and 1317 for 1:17 PM.

I will be using this database on several computers, but only a couple that will be used for time entry.

The Excel spreadsheets work well, but I have found them cumbersome trying to dump all the information into a Master spreadsheet from several different individual spreadsheets and I am using Access as our ERP so it will save time if I just add a simple form to track time from there putting it in the hands of the Repairmen and save someone from data entry late.

View 7 Replies View Related

Forms :: Text Box To Store Numbers - Thousand Separator

Aug 11, 2015

I have a user input form with a text box that stores a number. When the user inputs the number, I'd like it to display the comma separator (e.g. "1234" becomes "1,234". I've tried putting "#,###" and "#,##0." into the format property of the text box, but I still get 1234.

View 4 Replies View Related

Import CSV File - Field With Numbers Containing Thousand Space Separator

Aug 12, 2014

Any way to import a file containing numbers with a "thousand space separator"

example :

1 000
2 000
3 000
4 000 000
5 000 000 000

Only workaround I found so far is to import de numbers into a text field in a temp table, do an update query to remove the spaces and then transfert the data into the real table that has a numeric field.

View 14 Replies View Related

Queries :: Crosstab Queries - Export Command Ask To Enter Date Parameter Twice

Feb 24, 2015

I have a crosstab queries which uses the date query parameters. However, when I go to my Export command (code is below), it ask me to enter the date parameters (start date and end date) twice. What do I have to do so that the system will ask me to enter once only?

Code:
On Error GoTo Err_cmdTest_Click
'Must 1st set a Reference to the Microsoft Office XX.X Object Library
Dim dlgOpen As FileDialog
Dim strExportPath As String
Const conOBJECT_TO_EXPORT As String = "qryEXPORT"

[Code] .....

View 9 Replies View Related

Queries :: Access Multiple Queries Run With Date Parameter

Jun 19, 2015

I have 5 queries that I am running. The first query has the date range parameters set in the field area that I need to run and each additional create table query is based off the results of the previous query.

1. Which is better to use to run all of the queries in one simple step? A macro or a form? I am exporting the final table to excel so that I can make some additional adjustments off of it.

2. How would I setup the date range parameters for the first query if I were to use a macro without going into the query itself and updating the date field? I tried setting up a macro to run the queries by using the OpenQuery action for each of the 5 queries, but I cannot figure out how to do the date range.

View 11 Replies View Related

Queries :: Sub-queries With Text Box Based Parameter

Sep 18, 2014

I'm trying to perform a DELETE query at run-time. The criteria for deleting records is somewhat complex due to various one-to-many dependancies between the tables, overlapping of date fields etc., so in order to restrict the DELETE to only those records which qualify, I've set up a load of smaller queries to produce the list of eligible records.There is only one parameter required - a 'CutOff' date which is arbitrarily chosen by the user and is available in a textbox control on an open form when the code is triggered.

Here is the main DELETE query :

Code:
DELETE DISTINCTROW [tblComments].*
FROM [tblComments]
INNER JOIN [qryCommentsToPurge]
ON [tblComments].[CommentID] = [qryCommentsToPurge].[CommentID]
WHERE [tblComments].[CommentID] = [qryCommentsToPurge].[CommentID]

I've put qryCommentsToPurge and all the cascading sub-queries below - have highlighted in red where the parameter value is required (it is used in the queries to identify the records which must be retained, i.e. not deleted)Each of the individual sub-queries works fine and correctly (they return the correct population of records that they were designed to)If I run the sub-queries manually, I am prompted to provide the CutOff date, as you would expect - and the recordset returned in each case is correct for that date.

If, however, I run the DELETE at run-time (with the form containing that textbox open and containing a valid date value) I get a 3061 error :Suggesting that the queries can't pull the parameter value from the textbox on the form. But I've stuck a watch in the debugger on [Forms]![frmArchive]![txtCutOffDate] and I'm getting the correct date value? The form is open and available at the time.So why can't the query see it? I use these kinds of control references elsewhere in other queries and they work fine. I don't understand why it's a problem here?

Code:
SELECT [tblComments].*
FROM [tblComments]
INNER JOIN [qryIssuesToPurge]
ON [tblComments].[IssueID] = [qryIssuesToPurge].[IssueID]
ORDER BY [tblComments].[CommentID];

[code]...

View 1 Replies View Related

Parameter Queries Vs Parametrized Queries

Nov 5, 2004

I have been asked to set up a parameterized query using 4 fields (ID Number, Surname, Christian Name and Treating Dr/s). When I search Microsoft On-line under parameterized queries it gives a tutorial which basically set out a simple query with "prompt" parameters in the Criteria field. When I search under the Access Help it gives me a totally different explanation - ie. setting up a cross-tab query first and then defining parameters. Is this a loose use of terminology or is there indeed a difference. Help please!

View 1 Replies View Related

Parameter Queries

Jun 29, 2007

Is there a way to label a parameter in a query?

I need to enter a start date for a query - the parameter - and the end date is always six months later.

Currently, I use;

Between [Enter Start date:] And [Enter End date:], but this is not idiot-proofed.

How can I make the second parameter be a calculation based upon the first; i.e., [First Param] + 180 days?

Thanx for any help!

View 2 Replies View Related

Parameter Queries

Nov 15, 2007

Hi there.

I am looking to rationalise some of the queries I have in my access application.

Let's say I have two forms that query the same table based on a value they have in a combo box.

Currently I would have a separate query for each form and set the criteria to the name of the control on the respective form.

My question is whether I can use just 1 parameter query and use this for both forms, passing the necessary criteria - similar to how you would with an SQL Server stored procedure.

I have done this in the past programatically but wondered whether it is possible to do this within the GUI?

One solution is to not have any criteria in my query and then define an SQL statement in the rowsource of my form/control that queries my original query i.e.:
"SELECT FirstName, LastName from Qry_Customers WHERE QryCustomers.CustomerID = ????"

This works but it not as easy to maintain as having separate queries (same reason why I prefer to use stored procedures rather than definining my SQL statements within my code)

Also are there any negative performance impacts in defining the rowsource in this way (opposed to just setting to an existing Table/Query)?

Thanks,

View 1 Replies View Related

Parameter Queries

Nov 22, 2004

I have a query field with the criteria: [enter state]. I would like to be able to enter multiple states (ie: IL or WA or AZ) but the query only functions when one individual state code is entered. Any ideas how to fix this? Thank you.

View 1 Replies View Related

Need Help On Parameter Queries

Dec 18, 2006

I'm new to this forum and am looking for help in the following:
I'm trying to create a parameter query (using Access 2003) and would like to display just the data that are not null. I tried to insert "and Is Not Null" after the [parameter name] under "Criteria", but it still list null data. Any help will be greatly appreciated (please note that I am a basic Access user and do not do visual basics or anything other than the quick command buttons or the wizard.

Many thanks in advance

View 3 Replies View Related

Date Parameter Queries

Jan 9, 2006

Hi everybody,

I have a report that is based on an underlying query.At the query level,I
want to define parameters of date data type so that records to be displayed
should fall between DateA and DateB. ie Between[Enter Date A:] And [Enter Date B:].
I want the DAteA and DateB to be only days and Months of a year.

Say my DateA = 01 Jan 06 and my DateB = 31 Dec. 06

But I want only the Parameter to be Between[Enter day and Month A:] And [Enter day and Month B:].


How can I write a query with the two parameter values?

Thank you

dfuas

View 1 Replies View Related

Multiply Parameter Queries!

Apr 13, 2007

i have a Query where i have Criteria for two fields as the following:

Field :Date of Incident
Crirteria: [Forms]![frmSearchStudent&Date]![cboStartDate] And [Forms]![frmSearchStudent&Date]![cboEndDate]

Field: StudentSurname
Criteria: [Forms]![frmSearchStudent&Date]![Combo0]

Occasionally, staff may just want all incidents (records) to be shown for the selected StudentSurname and so, just select the surname and leave the date fields blank.

i tried the following:
Field :Date of Incident
Crirteria: [Forms]![frmSearchStudent&Date]![cboStartDate] And [Forms]![frmSearchStudent&Date]![cboEndDate]
Or: [Forms]![frmSearchStudent&Date]![cboStartDate] Is Null And [Forms]![frmSearchStudent&Date]![cboEndDate] Is Null

Field: StudentSurname
Criteria: [Forms]![frmSearchStudent&Date]![Combo0]

then when i tested this by leaving the date fields blank and selecting a valid student surname it simply returned all incidents (records) for ALL students not the selected one.

is it possible to achieve this? if so, could someone please help!

View 6 Replies View Related







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