IIF function not returning the false value. I have the following results based on the query shown below.
SELECT Trade.Ref_No, Trade.CERS_Price, Market.[USD/EUR_Rate], IIf("CERS_Price_currency = US Dollar.USD",[Trade].[CERS_Price]*[Market].[USD/EUR_Rate] , 0) AS [Price In Euro], Market.[USD/CHF_Rate], Trade.CERS_Price_Currency FROM Status INNER JOIN (Market INNER JOIN Trade ON Market.MarketDate = Trade.Trade_Date) ON Status.StatusID = Trade.StatusID;
Price In Euro USD/CHF_Rate CERS_Price_Currency CERS_Price 35 7 US Dollar. USD 5 91 7 Euro. EUR 13 1,715.00 7 Brazil Reais. BRL 245 759.00 33 Indian Rupees. INR 23.00
As you can see returns all calculations whether is USD or not. Can you help please? Ultimately I want to do this for all other currencies by nesting the IIF function.
I'm really not sure how to go about this. I'm creating a course booking system and when creating a booking I need to check for current bookings with the same employee and course id's (i.e. the employee is already booked on the course). The query takes the employee and course id's from a form, and is initialised when the 'book' button is pressed. It correctly selects if the person is already booked on the course but I want the query to return a value to the form i.e. if it returns null/false then the booking can be created but if it returns a record/true then the booking already exists and a message box can be displayed.
I'm not sure if I'm going about this the right way, can anyone suggest how this can be done as described above or suggest a better way of doing the task?
Greetings, I've been banging my head on this for days, and what really makes this difficult is the number of websites which say it should work just fine!
I'm working with Access 2003 and trying to make use of the IIf function. I have given my fields generic names in the examples below.
I have a number of items I want to search upon in my search form. Each item has a check box and a combo box. I want the query to look at the check box. If the box is checked, I want the query to use the value in the combo box. If the check box is UN checked, I want the query to ignore this field and return all values. I thought this was simple, until I tried to do it!
Here is my code, placed in the Field-name criteria box of the query:
This will return all records where Field-name = 2.
So... my original code should work! Because no "false" condition is stated, the query should be blank, and should return all records. But it doesn't! Truly maddening.
Here are some attempts which did not work:
IIf([Forms]![form-name]![checkbox-name]=True,[Forms]![form-name]![combobox-name],>0) ---> The ">0" caused an error. In fact, I can only specify an integer - all else, including things with operators, do not work.
Working with nulls - it does not seem to recognize an unchecked box as a null.
That's the short version of the story - any and all ideas welcome!
So I have a list of records in a continuous form. Within that record is a checkbox called GRT. GRT stands for Gross Receipts Tax, when it is checked I have an after update event that adds a new auto-generated record for the GRT entry. The new record copies the date from the origional record, calculates GRT from the origional records amount field and some other things like that to create the new record. Creating the GRT record entry has went well.
But, if the user removes the GRT checkbox from, or deletes the origional record, I need to delete the corresponding auto-created GRT record. I thought I could do this by simply grabbing the origional records ID and copying it into the auto-generated records field called "AssociatedID".
Problem is, when I reference the origional records record ID, it always comed in as "-1". I can display the ID on the form and it shows correct, but if I msgbox the records ID, it shows as "-1". I cannot figure out how to capture the origional records ID so I can insert it into the new auto-generated record so the two records are linked so I can later use that link to delete the proper associated record.
In A2010 I maintain a database originally created in A2003. The original version was locked down tight. In A2010 I struggled to do the same but got there in the end, as well as allowing me a back door way in.
Now I have an unexpected problem - in the object browser (or whatever it's called) on the left hand side I can no longer copy any object. EG, I want to copy a form for safe keeping while I edit the original.
Using DoCmd.TransferSpreadsheet I'm exporting a table which has a couple of Yes/No fields formatted as Yes/No. However when I export, they appear as TRUE/FALSE? Am I doing something wrong?
In a form, the value of any field may determine if the other field will be true or false. For example in my form, inventory, if value in code is equal to 2 then the Field Table will be automatically false.
How to get the last character of the string in query?
I have a table name PlateNo and I want to get the last character for registration purposes.
Ex. ZMD-123 - I want to get the number three(3) and if its possible every time the user types the last digit in criteria it will show all plate number ending in the entered number.
I have a string where alphabetical and numerical characters are mixed up. I need a string function where I can find the index of the first non-numerical character. I tried with the mid function but could not get it to work.
i have aform which class module where i make 2 queries the first works fine but the other always return values with zero my select syntax is in clsschool and the query is
INSERT INTO Enrolled_Students (Last Name, First Name, Address, town/city, county, postcode, phone number, date of birth, age) SELECT Last Name, First Name, Address, Town/City, County, Postcode, Phone Number, Date of Birth, Age From Candidate Details Where IsNumeric (Student ID);
I am upgrading an Access 2000 system to 2007 and replacing user toolbars with Ribbons.I have a strange parsing error that I think is not my error.
I have placed the following control into a group:
<control idMso="GroupPrintPreviewClosePreview" label="Close Preview" enabled="true"/> and "the system" rejects it with Error Code 0x80004005 Element <group> is not expected in <group>I
t turns out that it is finding the word Group within the double quotes and interpretting is at part of the XML syntax.
Change to another idMSO and the problem goes away. Same happened with another control that had the word Group in the id.
I have a website which uses a series oif ASP/VBscript scripts to access and update an Access database. It has run for years on a shared commercial service.I also have a replica of the wesbite on my home pc for development and testing running under XP Pro and IIS. All works fine.
Recently I have had to switch my home setup to my laptop (also XP Pro and IIS). The scripts all appear to work ok except when I try to UPDATE certain tables.
Some give "Syntax error in UPDATE statement." Some give "Data type mismatch in criteria expression." Some work without error
Yet the identical script and table on the main site and my home PC work fine and have done for years.
I have splited the system into foreend (FE) and backend (BE). FE and BE are located in different PC lying in company internat! However, I found there always give an error message 3219. And, nseems it is caused by not pointing correcly to the BE when I open tables, the syntax are as follows
Dim db As Database Dim rs As Recordset Set db = CurrentDb() Set rs = db.OpenRecordset("Invoiceyr", dbOpenTable) rs.MoveFirst rs.Edit Me.THISYR = rs!Invoiceyr
The 3219 error appeared at statement "Set rs = "what's the syntax of the path that I should include in the statement in order to point correctly the BE.
I've come across a simple error that has me baffled. I continue to receive the run time error 3075: Syntax error (missing operator) in query expression 'tblMasterPersonnel.FirstName"042" Or (tblMasterPersonnel.EmpID)="044"))'
Here is the strSQL
Code: strSQL = " SELECT tblMasterPersonnel.EmpID, qryiuSSN.SSN, ""SSN"" AS [ID Type], """" AS TXN, tblMasterPersonnel.LastName, " & _ "tblMasterPersonnel.FirstName, tblMasterPersonnel.MI, """" AS Suffix, IIf([tblMasterPersonnel].[Gender]=True,""F"",""M"") AS Gender, " & _ "tblMasterPersonnel.Birthday, tblMasterPersonnel.PlaceBirth, """" AS [Country Code], """" AS Country, tblAddresses.Phone1, " & _ "tblAddresses.Street, tblAddresses.City, tblAddresses.State, tblAddresses.Zip, tblAddresses.Country, " & _
For instance, first table export to EXCEL CELL A1 and then second table export to the same EXCEL but to CELL A5! I simply do not know the sytax to tell ACCESS to do the correct export!
e.g. DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "EXPORTDATA", "c:EXCELSHEET.xls", True
I maintain a large database of employees. I have a form with a combo box (cmb_department) which I can use to select a particular department. I have written an After Update event procedure which updates the relevant fields on the form after I've selected a department - e.g. their new manager's name, phone number, etc. based on my departments table.
Here is my code, which works well:
Private Sub cmb_department_AfterUpdate() If (Me.is_leaver = "" Or IsNull(Me.is_leaver)) And (Not IsNull(Me.employee_number)) Then MsgBox "This member of staff is an internal HEY employee. Their departmental details will not change to that of the department, however they can still be set up with GP Browser access."
[Code] ....
However, I'd like to do two things which I'm currently unable to get working...
1. If I delete the department name from the box, or select a NULL value, I get a VBA error - run time error 94, invalid use of Null. I will sometimes want to select a Null value to "unassign" a person from this particular type of department but I'd like a way of selecting a Null value and having it simply set to Null which if the form's default value for this field.
2. As you can see I have a MsgBox which checks to ensure you want to overwrite the existing data for the member of staff. If I select Yes then it overwrites. If I select No I'd like for it to set the value of cmb_department back to the PREVIOUS value. At the moment my script sets it to NULL which doesn't really work - for example, say someone is currently set to the Sales department, and I accidentally click to change them to the Warehouse department, I'd like clicking "No" to revert them back to Sales...
I would like to execute a code to remove the duplications in the MS Access Query but keeping one one data of the duplications.
For example, in the below data, I want to check for the data in the column Part No. The part number 123 and 234 are repeated twice so I want to delete the part no 123 and 234 that repeated second time and keeping the one data.
How can I enable a user to click a thumbnail image or other object on a form that will open the bigger orginal image file in a separate browser window (or other photo viewer)?
I concatenated 2 fields CR_Numbers: = CR_Number & [Sub Number] to display 12.01: from 12 and 1. I am now wanting to lookup the CR_Numbers to edit or add information into other fields.
I want to use a pop up form to edit/add data without having the form add an entire row to the table. How do I reference the Table ID so that it will go to the equivalent row to add the data in?
Main Table = Change Request Email Table = AORB_Email Fields in Form!AORB_EMail: Change Request (CR_Numbers), Priority (Pri_Name), Hours (Hour)
I plan on using the Priority and Hours in the email to set some dates and expiration times as well as in the subject of the email. I have figured out the email setup, and if I manually fill in the Priority and Hours fields everything works as it should.
Hi I have some drop downs on my form, which has some code that decides which recordsource to use. When I first select an option from the drop down, the query takes 10 seconds to load data. I then select another option, which runs a different query, which takes x seconds. If I then select the original option from the dropdown, the data loads onto the form in less than a second.
Why is there a delay the first time round and not the next? Has Access saved some kind of query plan? If so, why doesn't it save it permanently?