Forms :: IIF Statement Returning Incorrect Value In Subform

Jun 16, 2015

I am trying to sum a column on a subform named Cost of New if another column named Final = any of the values listed in my code. However, it is summing the Cost of New column regardless of the values of Final. It is summing for all values.What do I need to modify to make this correct or should I do it another way?

=IIf([Final]="RPR-RPR & RTN" Or [Final]="NFF-TST & NFF" Or [Final]="RTN-RETURN" Or [Final]="SCL-SCR LOCALLY" Or [Final]="SCR-SCR RETURN" Or [Final]="BER-BER RTN CST",Sum([Cost Of New]),Null)

View Replies


ADVERTISEMENT

Queries :: Returning Set Of Numbers From Custom Formatted String - Incorrect Use Of Join?

Mar 20, 2015

I suspect my design is flawed

Code:
SELECT tblData2.Prefix, tblData2.LineNum, tblData2.Year, tblComments.comment, tblComments.Address
FROM tblData2 LEFT JOIN tblComments ON tblData2.LineNum = (NumbersOnly([tblComments].[Address])
WHERE (((tblData2.MyYear)<1990))
ORDER BY tblData2.LineNum;

The NumbersOnly function returns a set of numbers from a custom formatted string. The above fails on the join (I think) but maybe there's another way of doing it?

View 4 Replies View Related

Queries :: Parameter Query Returning Incorrect Results Based On Checkbox

Jul 31, 2013

I have a parameter query that contains information on a list of people and contains 3 checkboxes: alumni, parent, business

In this query, I am trying to use parameters to filter the results based on these three fields i.e.

true, false, true would return all records where either alumni, business or both are true, and parent can be either true or false.

false, true, false would return all records where only parent is true, and the other fields do not matter.

View 2 Replies View Related

Forms :: Delete From Statement Returning 13 Mismatch

Mar 7, 2013

I am trying to delete from a form, the record in the JD SOP TBL where the record Job Description matches the Combo Box "Job Description" on the form, and the Required SOP in the table matches the selection in the list box "SOP List". The list box has multi select to none and both fields are text fields.

Code:
DoCmd.RunSQL "DELETE FROM [JD SOP TBL] WHERE [Job Description] = '" & [Job Description] & "' " And [Required SOP] = " & SOP_List & "

View 5 Replies View Related

Modules & VBA :: Runtime Error 3071 When Used With IF Statement To Highlight Incorrect Entry

Jun 23, 2014

In my database I am trying to produce a "Statistics" function. As part of this, the user will enter a "Start Date" and "End Date" in a form and then click a button which will open the requested report with the date drawn from a query. The code on clicking the "All Jobs" button is:

Code:
DoCmd.OpenReport "RepStatisticsAllJobs", acViewPreview

Which works perfectly.

I am trying to stop the user from leaving the date fields blank or entering dates outside of the range of the database so I have tried the code:

Code:
Private Sub AllSalesEnquiries_Click()
If Me.DateFrom = "" Then
Beep
If MsgBox("You have not entered a start date", vbCritical, "Start Date Not Entered") Then

[Code] ....

If the user enters dates within the range of the database the report is presented correctly.

If the user does not enter a date or enters one outside of the range it produces the correct message box however if the user then corrects the mistake I receive a Runtime Error 3071 message. Clicking "Debug" highlights the final line of code:

DoCmd.OpenReport "RepStatisticsAllJobs", acViewPreview

I know that the code is correct because it works fine as stand alone code and it works if the user enters the correct dates so I am not sure where I am going wrong.

The date format works perfectly for the way dates are formatted in the database.

View 10 Replies View Related

Fix SQL Statement, Returning Error ...

Oct 19, 2007

Hello,
Run-time error ...
No value given one or more required paramete


UPDATE GuitarOptionDetails SET GuitarOptionDetails.OptionCombo = Concatenate("SELECT Option_Item FROM GuitarHeader WHERE GuitarItem & Option_Item =""" & [GuitarOptionDetails].[GuitarItem] & [GuitarOptionDetails].[Option_Item] & """");


basically i need to create an update query to update the OptionCombo field where:
1. OptionCategory=BODY
2. Combine all the BODY OptionItems as one into the OptionCombo field (the Concatenate() function should accomplish this portion)
3. For each InvoiceNumber AND GuitarItem.

NOTE: some invoices will not have any BODY Option_Item, this can place "N" in the OptionCombo BUT only if the invoice does not have a single BODY Option_Item, if it does, it needs to put the combined BODY Option_Item values into the OptionCombo field.

How should I rewrite the SQL to achieve this without getting this error?

View 14 Replies View Related

Queries :: IN Statement Not Returning Records?

Mar 10, 2015

I have a query that I set up to return multiple records. The number of the records is in that text box. I have tried to set the where clause to the text box but for some reason I don't get any of the records I want returned. I am using a Where... IN statement. I have tried to put the numbers in single quotes and no quotes and I have had no luck at all. If I do individual records they will return, just not when I try and do more then one at a time. This query is a part of something more, but since it doesn't return anything, Here is my sql statement

Code:
SELECT CalibratedEquipmentListTable.ID, CalibratedEquipmentListTable.Manufacturer, CalibratedEquipmentListTable.ModelNo, CalibratedEquipmentListTable.Description, CalibratedEquipmentListTable.SerNo, CalibratedEquipmentListTable.LastCal, CalibratedEquipmentListTable.CalDue
FROM CalibratedEquipmentListTable
WHERE CalibratedEquipmentListTable.ID In ([Forms]![ReportForm]![Text41]);

View 6 Replies View Related

IIF Statement Returning Same Result For True And False?

Jan 10, 2012

I've built an IFF expression that is determined by a number of variables.

If any of the Data fields are filled I want the statement to return true.

If NONE of the four are filled in I want it to return false.

As it is, it returns true no matter what.

Here is the expression I'm using:

Title: IIF (IsNull([Data1] and [Data2] and [Data3] and [Data4]), True , False)

View 7 Replies View Related

Iif Statement To Read Fields From Form Not Returning Values

Nov 4, 2006

Hey there!
I've been searching about this forum and found a lot of threads on this sort of issue but haven't been able to figure it out from those alone, so feeling a bit useless :o long winded explanation by the way... I'm useless at explaining! :D

Well basically I have a query that is supposed to power a flexible search form, where you choose the fields you want to search by and enter your criteria. The form contains labelled fields with checkboxes next to them, which you tick if you want to search for something in that field. The results are displayed in a subform which reads from the query.

The problem is with the query! My solution seemed to work fine when I put my criteria in just one field when testing (that is the fields in query design builder, not the form), but when I applied the same to two fields it didn't. Instead, it would return nothing unless I specified exact and correct criteria for BOTH fields I had set up with my solution. So whereas before I could tick "Customer" and search for a customer account number and it would display ALL relevant records, now if i just ticked "Customer" and entered the same number, it would display nothing, unless I ALSO ticked "Booking" and entered a correct booking number that matched a record for that customer in the tables.

I've heard iif statements don't do too well in the criteria fields in the query design builder?? But I know nothing about using SQL really.

For example for the invoices field have used:
IIf([Forms]![frmFindInvoices]![ChkInvNo]=True,[Forms]![frmFindInvoices]![InvNo])

So:
IIf(form checkbox = true, form text box value)

However it seems to think that if the checkbox is not ticked, I want it to only display EMPTY invoicing fields. This is never the case and so no records are shown! If the tick box is not shown, there is not supposed to be criteria for this field, in other words it should allow ANYTHING through.

What I don't know how to do is tell the bloody thing that if the box is NOT ticked, it is NOT to check for anything in this field, because the user does not want to specify any criteria for this field! Things like "Is Null" produce the same results, probably because the query still thinks I want it to find records that have empty fields.

Any suggestions to specify to the query what I want? I really need to get this done! Thanks! :)

View 11 Replies View Related

Forms :: Incorrect Name Of Form Displayed

May 6, 2014

I saved my form with a particular name and I have used that name all throughout my code and it still works fine. But when I open that form, the name I see on the top of the form is not that name at all. It's actually some value I gave a combo box a while ago.

View 2 Replies View Related

Forms :: Label Border Color Incorrect

Jan 9, 2014

Using Access 2010. I have a form on which I've placed a simple label. I try to set the label border color to black but it shows grey. I can set the border color to #000000 and it's grey. I set it to #000001 and it shows black as expected.

I'm thinking it has something to do with the themes, but shouldn't an exact color code show as expected? As a new member (<10 posts) I can't post an actual link, but here's the text of the location: [URL] ....

View 2 Replies View Related

Forms :: Sorting Numerically - Incorrect Listing

May 16, 2013

I have a form that lists evidence items 1, 2, 3, ect....

The form is listing them 1, 10, 11, 12, 13, 2, 3, 4, 5...

I have tried right clicking the evidence item # field and doing a sort a to z, and it is still listing them the wrong way.

View 10 Replies View Related

Returning To Main Form From Subform

Apr 25, 2005

Hi,

I've a form that has 2 subforms - which subform is used is dependant on the selection of a combo box in the main form. After much time spend trying to set this up I am happy to report that this section works fine.

My problem is that when I have completed the subform I am not able to continue tabbing through the rest of the form.

Any help would be great,

thanks
Barry

View 1 Replies View Related

Forms :: Form Name Incorrect In Form View

Dec 23, 2013

I have a form which displays an incorrect form name in the header/tab when in form view - its always correct in design view. Somehow it chooses to display the name of another form I have in the database. I have tried saving the form to a new name, this does not solve it. I have also tried saving the other form from which the name seems to have been borrowed, but this makes no difference. Incidentally, now matter what names I give the two forms, the original (incorrect) form name persists. I have tried compact and repair and vba debug. No effect.

View 1 Replies View Related

Forms :: Combo Box Keeps Returning First Record In Query?

Jan 27, 2014

I am using A2007 and this one combo box is returning the first record of a query no matter what record I pick. My other combo boxes are working fine.

When I pick a record the "after event" works fine by placing the data in the proper text boxes and then returns the first record in the query.

View 3 Replies View Related

Forms :: Expression On Text Box Returning Wrong Value

Mar 29, 2013

I have a form used for taking inventory. One table to lookup items, one for writing values. Tables linked by an ID #. I created a text box on my form to lookup a value called PARQTY in the lookup table. I need to be able to subtract that value from the QTY that is entered into the Qty_Counted box on teh same form when they take inventory.

I created a new Text box and in the control source for it, I entered an expresion that basically says subtract The PARQTY from the QTY_COUNTED it reads = [QTY_COUNTED] - [PARQTY]

The box is subtracting the QTY_COUNTED from the ID # that is linking my two tables and displaying it. Its not supposed to be subtracting the QTY_COUNTED at all. It should be subtracting the PARQTY value that is displayed from the QTY_COUNTED. The PARQTY box does display the right value from the lookup table so I can't figure out why it's pulling that ID number or where from. The rest of the form / program works and we've been using it for a few years. I also created that, but like now, I had to muddle through each and every little thing I did.

View 9 Replies View Related

Forms :: DLookup Returning Value Of First Record Rather Than Specified Criteria

Oct 28, 2013

I'm using a Dlookup in expression builder and it's only returning the value of the first record rather than the criteria I specify.

View 6 Replies View Related

Forms :: Search Button Not Returning Records

Aug 6, 2014

I have a search button / text field on a form with the following code:

Private Sub SearchButton1_Click()

Code:

Dim rsTemp As Recordset
If IsNull(Me.SearchField1) = False Then
Set rsTemp = Me.RecordsetClone
rsTemp.FindFirst "[CompassRef] = '" & Me.SearchField1 & "'"
If Not rsTemp.NoMatch Then
Me.Bookmark = rsTemp.Bookmark

[Code] .....

Unfortunately it only returns the 'No record found' MsgBox, even if SearchField1 is populated with relevant content.

View 9 Replies View Related

Forms :: Returning Values From Tables Based On Criteria

Jun 27, 2013

I have two tables that will contain the information that I need the third table that will be used for constant data entry to auto fill in two of the fields (Class, Rate)based on four criteria from the first two.

Table 1
EmpID Name
1 EMP1
2 EMP2

Table 2 (A Subtable of Table1 based on EmpID)
EmpID ACDate Class Rate MJob SJob
1 1/6/13 A 15 100 1A
1 2/6/13 B 20 100 1A
2 1/6/13 A 18 100 1B

Table 3
Name WDate MJob SJob Class Rate
EMP1 1/7/13 100 1A A 15
EMP1 2/5/13 100 1A A 15
EMP1 2/6/13 100 1A B 20
EMP2 1/6/13 100 1B A 18

View 2 Replies View Related

Forms :: Returning Value From A Query To A Form Text Field

Apr 16, 2013

I am using Access 2007. Second, I am using two tables, Inventory and Service Request. Inventory is a list all the Inventory, with has things like location (building & room number), type (desktop, laptop, etc.) and access tag number. Service Request also has Access Tag Number (should link back to Inventory) & date of reported/resolved problem and description of problem/solution.

On my form for Service Request, I have the access tag number as a fill text box, when you double click on that text box, it runs a Query that asks for the 1) Building, 2) Room Number & 3) Type . . . Query currently opens in a the spread sheet view that shows those three things but also the Access Tag Number associated to them.

I would like that Access Tag Number to just return into the field that was double click to start the query.

Is this possible? If so what am I missing?

View 1 Replies View Related

Forms :: Formula Not Working - Empty Field Returning

Jan 31, 2014

I have a date in "date to engineering" of 13/ 01/2010 but I am not getting a value in my field which should be 1479 my field is just always returning an empty field

Code:
=IIf(IsDate([date to engineering]),"",IIf(IsDate([date from engineering]),Now()-[date to engineering],[date from engineering]-[date to engineering]))

View 4 Replies View Related

Forms :: Added A Field Using Expression Builder Which Is Returning Name?

Jan 18, 2015

So I have built a form and added a field using the expression builder which is returning #Name? There is a relationship between the table on which the form is based and the record I am adding to a control.

View 1 Replies View Related

Modules & VBA :: Syntax Error With INSERT Statement And Subform

Mar 13, 2015

I am getting a syntax error on my SQL statement.

On a form I have a sub form containing the field txtGuestID - whose control source is GuestID.

On the main form I have a button that fires the code below.

I am sure I am not referring to the control txtGuestID correctly.

Code:
Private Sub cmdInbound_Transport_Click()
Dim iProductID As Integer
Dim sSQL As String
On Error GoTo cmdInbound_Transport_Err

[Code] ....

View 6 Replies View Related

Forms :: Returning Difference Between Date / Time Values In HH.MM Format

Dec 11, 2013

I want to be able to display the result of a difference between Date/Time values in "HH.MM" format (i.e. yes I want the result in decimals and I don't want Access to round up or down just because it feels like doing it!). I have used the following:

Example 1:

Dim ActualManHours as Long
ActualManHours = (txtEndTime.Value - txtStartTime.Value) * 86400
txtActualManHours.Value = ActualManHours

Example 2:

Dim ActualManHours as Long
ActualManHours = DateDiff("h",txtStartTime.Value, txtEndTime.Value) & "." & Format(DateDiff("n",txtStartTime.value,txtEndTime. value) Mod 60, "00")

Example 3:

Dim StartTime as Double
Dim EndTime as Double
Dim ActualManHours as Long
StartTime = CDbl(txtStartTime.Value)
EndTime = CDbl(txtEndTime.Value)
ActualManHours = EndTime - StartTime
txtActualManHours.Value = ActualManHours

View 7 Replies View Related

Forms :: Diary Filter Not Returning Correctly Filtered Records

Sep 12, 2013

I have created a piece of code that filters a sub form of diary records using criteria the user has selected or entered. It was working fine when I made it a month or so ago and now is seems to be returning incorrectly filtered records, for example, I enter 2 dates to return all diary entries between the 2 dates. Yet it misses some records out that should be within the date range, and it sometimes include records that are outside the date range. I am also getting an error when I try and filter the diary entries via the supplier, "data type mismatch", here's the code that, bearing in mind, was previously working fine.

Code:
Public Function filter_diary()
Dim dbs As Database
'Dim qdf As QueryDef
Dim Sqlstr As String
Dim sqlstrwhat As String

[code]....

View 1 Replies View Related

Forms :: Combo Box Returning Wrong Results In Access 2010

Jun 11, 2014

I have an unbound combo box that I set up in a form using the combo box wizard in Access 2010. I selected the option that says, "Find a record on my form based on the value I selected in my combo box." The problem is that the combo box will not always display the correct record. It seems to only display the first record of a group of similarly named records in a table.

Example:

Code:
Last Name First Name SSN
Smith Alex 123-45-6789
Smith Jane 234-56-7891
Smith Mary 345-67-8910

If I select Smith Jane, the record for Smith Alex will display. I know that this has something to do with the bound column property, but I am unsure what to do to fix the issue.

What I have tried: I tried setting the primary key as the first field, but then I could only search by the primary key, which is unrealistic for this database. Users will be searching based on last name. How do I make the combo box select whichever record I select from the drop down list?

View 4 Replies View Related







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