Need Help With Failing Iif Function

Feb 5, 2006

In my query I have the folowing expression:

Currency: Iif([Exch]="1";"Szt";"Eur") - if the exchange rate is 1 then the currency is Zlotty if different from 1 then it's Euro

When I run the query it returns "#Error" ?

Anyone have an idea to fix this?

View Replies


ADVERTISEMENT

Queries :: Failing To Filter By Criteria After Return Values From A Function?

May 15, 2013

I have two date fields in a table. I need to find the days between these dates and, if its greater than 7 days, I want to display the record in a report, so far, I have found a hand function that allows me to enter two dates and it returns a long data value representing the number of days in between the two dates. (google "I've developed the following code to count the business days between 2 dates." and its the second one that starts as SOLVED I made no mods to it as it does what i need it to do.

So, i added this to its own module within the data base for use within a query. My test query basically displays the unique ID, the start date and the end date and then displays the values returned from the function. here is the SQL:

SELECT [Main Table].[Unique ID], [Main Table].[Start date], [Main Table].[End Date], (Business_Days_Between([End Date],[Start date])) AS [Days between]
FROM [Main Table]
WHERE ((([Main Table].[Start date]) Is Not Null) AND (([Main Table].[End Date]) Is Not Null));

When ran, this Query works... However, when I enter a criteria like =2 or > 7, it says data type mismatch. I have even attempted the CInt() function to make sure its formated as int but i continue to get the same error.

View 11 Replies View Related

Trying To Make A Program Failing

Feb 17, 2007

well i am trying to make a very simple program that would help me learn the capitals of each country. yes it is a weird thing to do but i just it might help.
anyway i started doing it using access and made a table with three columns primary key number, country and capital.
I started making a form and im tryin to make it so the program would randomly pick a country and i would have to choose from a list box the capital and i would have a command button which when i click will tell me if i am right or not and if i am not then it would say the right capital.
How should i do this?
p.s ino the basics of using the code builder
help much appreciated.

View 3 Replies View Related

SQL Failing To Pick Up List Box Value

Feb 26, 2008

Hi all

I have a form which is used for entering holiday requests.

It has fields such as name, type of holiday, date from and date to but it also has a list box value. This list box contains the number of days between the date from and date to and exludes weekends and bankholidays using data from a table. The data from the form is inserted into a table using an sql string when the submit button is pressed. The problem I have is that the sql does not pick up the number of days from the list box unless I click on the list box before I click on submit. It is almost as if the value is in the list box but it is simply not recognised by the sql unless I select the list box using the mouse. I have tried to select the list box using code when the submit button is pressed but to no avail. Does anyone have any ideas how I can over come this or perhaps how to physically select the list box so it is highlighted when the submit button is pressed??

Thanks all

Gareth

View 1 Replies View Related

Updating Query With IN STATEMENT Failing.

Dec 2, 2005

This is driving me absolutely insane, can anyone find why this won't work?

UPDATE tbl_PrivateMessages SET tbl_PrivateMessages.RecipientStatus = 1
WHERE tbl_PrivateMessages.MessageID IN ([Enter MessageIDs]);

I've tried updating it through ASP with the following:

Execute UPDATE_INBOX_MSG_STATUS 0,26,25

And also just tried running the query from access itself using 25,26 as IDs.

Neither of those seem to work...please advise. Also, I don't even get an error message as to why it didn't update.

TABLE STRUCTURE
MessageID - AutoNumber
MessageUserID - Number
MessageSubject - Text
MessageContent - Memo
MessageAuthor - Number
MessageDate - Date/Time
AuthorStatus - Number
RecipientStatus - Number

Many thanks

Steve Johnson

View 4 Replies View Related

Multiple INSERTs At Speed Failing?

Aug 29, 2007

I am trying to issue multiple INSERT statements in a row - but it seems that only the first succeeds. If I put a 1-second delay between attempts, suddenly they all succeed (so I know the statements themselves are all valid, it's not a data issue).

These are all being issued in a loop from the same thread, so as far as I can see unless the data is being inserted asynchronously, I can't see any problem. If it is being done asynchronously - how are we supposed to know one INSERT succeeded and thus we can issue the next one?

Anyone have any idea why this might happen? I don't want to leave 'magic delays' in the code!

View 2 Replies View Related

Referential Integrity Check Failing, And Can't Figure Out Why

Dec 8, 2006

Hello I'm helping a friend with an access project and the Referential Integrity check is failing for some reason unknown to me. I recreated the entire database from scratch and added all relationships before adding any data and then added in the data. The tables giving me problems are the following:

Orders Table:
OrderID - Primary Key Autonumber, Format:1000, Indexed: Yes(No Dupes)
CustID - Number, foreign key to a customers table, 1-many relationship
SalesID - Number, foreign key to a sales table, 1-many relationship
ShippingID - Number, foreign key to a shipping table, 1-many relationship
3 different date fields and a price field

This table is filled with data.

Order Details Table:
ItemID - Primary Key Autonumber, Indexed: Yes(no dupes)
OrderID - Number, Dec. Places: Auto, Required: Yes, Indexed: Yes(dupes OK)
RingID - foreign key to rings table, 1-many relationship
StoneID - foreign key to gemstones table, 1-many relationship
Ring Size - number

There is no data in the order details table.

The Orders to Order Details is a 1 to Many relationship with ref integrity and cascading updates and deletes enforced.

When I try to manually type in a record I get the "You cannot add or change a record because a related record is required in table 'Orders'" even though I added a lookup list box listing all the OrderIDs from the Order table. I know I'm typing in a valid OrderID number, but it's not taking it and throwing this error.

Any ideas why? You advice is greatly appriciated!

Thank you.

View 4 Replies View Related

Requery Failing To Add New Record To Form List

Nov 29, 2004

Hi,

I have inherited a buggy database thas has a simple piece of code that won't behave the way I think it should!
The code should add a new record and have that new record appear on the list form (where the button On_Click event is called) making it available for user edditing. In 99% of cases though, the blank new record does not appear. The record is getting created, as i can see it in the table and have added a watch to the RecordCount property, it just doesn't display automatically. The existing workaround for users is to click a second button that invokes a simple one line function sub that performs only a Me.Requery. The user presses that up to two or three times before the new blank record finally appears.

One solution I read about, but hesitated in trying due to the unprofessional 'flash' that occurs, was to close the form and the re-open it...anyone experienced this or can comeup with a neat workaround?

The code

Private Sub CmdAddRule_Click()

Dim db As AO.Database, intnextseq As Integer
Dim TestThis As String
Set db = CurrentDb()
Dim rstDao As DAO.Recordset
Set rstDao = db.OpenRecordset("select * from stblAllocRules order by intRUSequence desc;", dbOpenDynaset)
If rstDao.RecordCount > 0 Then
intnextseq = rstDao!intRUSequence + 1
Else
intnextseq = 1
End If
With rstDao
.AddNew
!AutRU_id = 0
!intRUSequence = intnextseq
!bytAppendBack = 1
!bytUpdateBack = 0
!bytDeleteBack = 0
.Update
.Close
End With

Set rstDao = Nothing
Set db = Nothing

Me.Requery
Me.Repaint 'I have used this staement in addition to and instead of the Me.Requery to no effect
Me.Recordsource = Me.RecordSource 'I have used this statement also in addition to the above to and in isolation, to no effect.
End Sub

View 2 Replies View Related

Network FE/BE Issue? - Complex Form/Subform Failing To Load

Dec 7, 2006

Hello all,

I have created a FE/BE database which is operating on a network. There is one FE for each person (approx 150) all accessing 1 BE. There are at most, maybe 10 people using it at once. The database has been working well for about 2 months.

My problem is not with data corruption (touch-wood!), but with a complex form.

The Form is split into a Header/Footer, with a Detail section containing a subform. The main form filters records that appear on the subform. The subform is continous, with several conditional formatting cells per record.

Most of the time it works fine, but occasionally, the main form opens, but the subform fails to load/open. All I see is a white page with the main form header displaying correctly along the top 1/3rd of the screen. No error message is displayed. If I print the page using a Report (The subform and Report use the same query) the page prints perfectly with all records showing.

I have seen this problem on several different workstations, only to try again later to see it working (having closed the db, logging off then back on again)

I am at a loss with this one. Is it a problem with Access or the network? I am unable to find anything similar to this problem on the forum. Can anyone shed any light on it?

View 2 Replies View Related

Reports :: Unbound Object Frame Failing To Display Linked Image At Correct Resolution

May 18, 2013

I am using an unbound object frame to display an .png image file which is set in vba.

The image is an excel chart saved as a .png

The problem I have however is that the image I save from Excel is great quality, and is pretty tack sharp, but when I display the same file in the unbound object frame in access, it is not nearly as sharp.

I am setting the picture property of the control as:

ubImageUserChart = "c: empmyChart.png"

It displays alright, but is just a bit fuzzy - still quite legible, but it is a complex graph with a lot going on - has regressions and formulas etc on the graph, and they need to be very clear.

BTW - the unbound frame is the same size as the Excel chart which gets saved as a .png file. If I tile the images (Access unbound frame and original file in picassa preview) side by side - they are identical - size, orientation etc.

It is not practical for me to try and do the chart natively in access as it is way to complex. I am using access vba to drive an excel session to do all the statistical yack work and chart rendering, then displaying a png image of the resulting chart in an unbound object frame in access.

View 7 Replies View Related

Reports :: Sub-reports With Pictures - Images Failing To Load

Dec 11, 2013

I have a Report containing a sub-report which holds the pictures. Typically there are 3-4 pictures per A4 page and 2-3 pages, so not millions, but for some reason whenever I load I get between 1-3 pictures a page and the rest show as blank. I can repeatedly reload time after time and get a seemingly random number of successful images.

The original images are on a network drive (but connectivity is good). They are high quality images but the load time isn't that bad (Is there a 'normal' load time for these things?) I wonder if it's just timing out after the first X pictures..

View 5 Replies View Related

Modules & VBA :: Creating A Function That Counts Records And Use That Function In A Query

Dec 11, 2013

So basically I need making a function that will count the number of records from another table/query based on a field from the current query.

View 2 Replies View Related

Forms :: SUM Function Produces Error From Calculated Function

Jan 30, 2014

I have a project at hand and it's been a predecessor of mine and client has asked me to do some work on it and extend functionality - but I have not really delved into Access before and I have had to worked my way through to this final snag :/

The Main Form has one sub form. This sub form allows the user to add multiple order items i.e. qty, stock, description from records within the system - fairly straight forward.At the last column of each row is the sub total of those particular items i.e.

Qty Unit | Item ID | Total
-----------------------
2 | 1234 | 80.00
------------------------
1 | 43526 | 20.00
------------------------
> | |

So the total is a function of =[Qty Unit] * [Unit Price].Then in the Footer of this SubForm is the Sub Total

=SUM([Qty Unit] * [Unit Price])

All fine and well..... However, the additional functionality kicks in.

Lets add the additional customer_id from the Main Form. Each Item bought is dependent on the customer_id i.e. they get special prices depending on who they are.So a New table is made which has the Item ID and SpecialPriceID (of a table to define as a specialPrice) and the Price linked to this Item and Special Price category. So say that there are two groups of users "wholesale" and "nonwholesale" these would be SP_1 and SP_2 and each client is defined either one of these, and each stock item has a Price for each SP_1 and SP_2. Hopefully I've explained myself there.

Back to the SubForm. So now the Total needs to calculated differently with needed the external customer_id from the Main Form.

Code:

Function CalculateSpecialPrice(ItemID As String, CustomerID As String, Unit As Integer)
Dim SPSelect As String
SPSelect = "SELECT Price FROM [Items_SpecialPrices] WHERE"
SPSelect = SPSelect & " ItemID = '" & ItemID
SPSelect = SPSelect & "' AND SpecialPriceID = (SELECT SpecialPriceID FROM Customers WHERE customer_id = " & CustomerID & ") "

[code]....

its the sub total I just keep on getting #Error on. I have even watched (using alerts) that the correct return variable is the same as the individual rows. This is the equation I used for the SubTotal within the footer.

=SUM(CalculateSpecialPrice([Item ID], [Form]![FormName]![CustomerID], [Qty Unit]))
#Error

View 2 Replies View Related

Date Function/need Time Function

Jun 9, 2005

We have a date function that converts a text date format. Can someone help me with time function to do the same thing? We want military time. The field is like this now: txt fields.
160037
213137
224356
235716
235800
12341
21708
22732
Here is the date function we use:
Function f2Date(strDateOld As String)
Dim strDate As String, strMonth As String, strYear As String
strMonth = Mid(strDateOld, 5, 2)
strDate = Right(strDateOld, 2)
strYear = Left(strDateOld, 4)
f2Date = strMonth & "-" & strDate & "-" & strYear
f2Date = CDate(f2Date)
f2Date = Format(f2Date, "mmmm d yyyy")
End Function

View 9 Replies View Related

Now Function To Convert To Date Function

May 25, 2006

Hi all,

I need a little help. In my DB, I have a command button set up (I was tired of typing in dates) for date, but I used the Now function, which also gives me the time.

Now I have over 3000 subrecords of the main ones. I now need to queries transaction for that specific date, but it also retrieves the time.

I tried to go back and change the NOW to DATE in VB, but the code does not run.

How do I change all records that have date and time (using NOW function) and only click that command button to show only the date (mm/dd/yyyy)?

Thanks in advance.

View 1 Replies View Related

Function

Aug 1, 2005

Is there any function that can convert either a True, False, "Yes", "No" or Null value.... to a yes/no (check box) data type?

What I want to do is create a make table query. I would like to add a checkbox field from the query. So if there was a function that could convert a data type to a Yes/No checkbox, this would be very helpful...

To give you and idea of what I'm talking about...and how I want to use this... If I am making a table from a query and I want to add a number field, but leave it empty for the time being, what I can do is make a new field in the query maybe call it "Number1". What I would do is Add this as a field in my make table query:

Number1: Cint("")


This will add a blank field that is formatted as a number field when I run the make table query.

So using the same logic, I'd like to make a blank (or unchecked) Yes/No check box field when I run my make table query.

Anyway...that's what I'm hoping for.... I hope someone can help!

Gary

View 10 Replies View Related

Function Isn't Available

Nov 3, 2005

I'm having a problem getting a form to open. I'm using access 97 on on XP machine and whan I open my database I get Function isn't available in expressions in query expression '[Case Types]![theName]&"-"&Format([SourceDocs]![CaseNumber]&"","00")&"-"&Format([SourceDocs]![CaseYear]&"","00")'.

This database works fine on a Windows 2000 machine running Access 97 but none of the XP machines will open it.

Any suggestions?

Thanks,
Rick

View 8 Replies View Related

CHR() Function Not Available

Nov 10, 2006

I have a database in which I am designing a report which includes a name/address block. I am surprised to find that the report does not recognise the Chr() function in the text box control source string "=[Organisation] & Chr(13) & Chr(10) & [Address]..."; designed to insert a CRLF between the contents of the named fields.

I know the syntax is correct because I've checked by using the expression builder to replicate the code. (Expression builder includes the Chr() function, as expected.)

The interesting thing is that the function is recognised in other databases used on the same machine, both those created remotely and locally.

Anyone know what could be going wrong?

Stuart

View 7 Replies View Related

Function Is Not Available

Sep 4, 2005

I am using a crosstab query to gather info from a table. I am using the Format [DateAppt], "mmm". The query ran successfully before but I now get the error "Function is not abailable in expression in query expression 'Format ([DateAppt], "mmm")'. This is used for column headings in a report that gives results by month.

I am using Microsft Office 2000 Premium with XP Professional operating system.

I used the original disk to repair Office thinking that the function was missing from the function library but to no avail.

Does anyone know how to restore this function?

Thank you,
Jack

View 1 Replies View Related

Help With IIF Function

Sep 29, 2005

Just wonder if anyone could give me some help on an IIF function used in my query:

I have a table which has numerous “W” codes, the charging for an order does not occur if it has a W12 or a W14 code and has no “[Authorising Name]” BUT does however charge if the weight of the order is over 100kg


IIf([WCode]="W12" Or [WCode]="W14",IIf([Authorising Name]="",0,[charge], IFF ([weight]>99,[charge],0)))

I can get this working for a single W code but not for the 2 OR I can get it working for both Codes but then the weight side doesn’t.

I have tried all combinations of <> = < etc etc but still no luck., I think I need another OR but no matter where I put it I hit problems either with the function or the result.

Another small issue, my [authorising Name] field can appear to be empty, but in the field are spaces what is the best way for ensuring I capture both empty and theses space records ?

Thanks in advance

View 4 Replies View Related

More Function Joy

Oct 12, 2005

Got on more question (I hope) about functions.

I have a table that contains a year (school year) and an End Status Code, I need to flag students that have the end status code of 45 in school year 2005.

When I use the below code the column popluates with "#ERROR".

IIf([ST010]![SCH_YR]="2005" And [ST010]![END_STAT]="45","Y","N")

Any Ideas?

Again thanks for the help..

--pete

View 1 Replies View Related

How To Fix Mid Function

Oct 21, 2005

I have a question:

SELECT DateSerial(2000+mid([enter],3,2),Mid([enter],1,2),1) AS datevalue;

it works in 2000 windows,
but it doesn't works in XP windows.

Why?
The error message the function mid has a problem.

How can I fix the problem in XP widows.

Thanks.

View 4 Replies View Related

How To Use The Function Now

Dec 11, 2005

hi there
am new to access and i want to know how to use the function now in a query
like i want to know all the birthdays in the date base by using the function now.. firstly i did date part for the day and the month,, then in the criteria box of the day i inserted the function now () but dont know what to put.. any1 can tell me what to do pleaseeeeeeeeee ???????/:) :) :)

View 2 Replies View Related

How To Use The Function Now

Dec 11, 2005

hi there
am new to access and i want to know how to use the function now in a query
like i want to know all the birthdays in the date base by using the function now.. firstly i did date part for the day and the month,, then in the criteria box of the day i inserted the function now () but dont know what to put.. any1 can tell me what to do pleaseeeeeeeeee ???????/:) :) :)

View 9 Replies View Related

IF Function

Dec 21, 2005

Hi

i need help using the "IF" function i think.


Basically i have 2 "columns"


A B
aaa
aaa
aaa aaa


Basically if i have say Column A that has some fields filled in and Column B with other fields filled in. I want to Populate a column C with either the stuff in A or B.

So If Column A is blank and Column B is blank, then i want Column C to stay blank.

If Column A is populated and Column B is blank, then i want Column C to be populated with what column A has.

If Column A is blank and B is populated, then i want Column C to be populated with what Column B has.



Thanks in Advance

D

View 14 Replies View Related

LN() Function

Jan 29, 2006

Can some please tell me if there is an equivalent of the excel LN() function in access.

I have tried to find it all over the web and beyond and cannot
:(
I dont mind if there is a long winded work around for this function.

I am using it in a query and it shows unrecognised function
but for some reason shows in the access help as below :confused:

LN
Returns the natural logarithm of a number.

Syntax

LN(number)

Number is the positive real number whose natural logarithm you want.

Thanks for your help
Cress

View 1 Replies View Related







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