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 Replies


ADVERTISEMENT

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

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

Queries :: Query Returning Wrong Results?

May 7, 2014

I have two tables Contacts & Allowance. There is a relationship defined between the two based on Contact ID (primary field/contacts - foreign key/allowance). The Contacts table has Firstname + Surname. I have produced a query based on certain fields in both tables however the result is totally pulling incorrect info.

View 11 Replies View Related

Criteria Returning Wrong Results/WHERE Clause Length

Jul 19, 2006

Hi there,

I'm working on a select query that I have created through the visual query design window in Access 2003, I have multiple criteria but the query is not filtering the results properly.

I'm selecting only records :

where the DeliveryCountry field is within the EU - works
where the ProductID does not contain Repair, Upgrade or Rpr - doesn't work
where the Demo/Sale ID is 2 - works


I've viewed the code in SQL view but I still can't locate the problem, though I suspect it lies in the treatment of ANDs and ORs.

The SQL is pasted below (I have reformatted with indentations so I hope it is easier to read).

One thing to note: the reason the countries list is split in two is because Access did this automatically when I had one long list. Is there a maximum length for WHERE clauses?

Thanks in advance for your help!

Abby

SELECT Orders.ShipDate, Products.[Standard Tarriff Number], [Order Details].[Quantity]*[Order Details].[unitprice]*(1-[discount])*(1-[special discount]) AS [Line Total], [Order Details].Quantity, Orders.OrdDeliveryCountry, Orders.OrderID, [Order Details].ProductID

FROM Products RIGHT JOIN (([Demo/Sale] RIGHT JOIN Orders ON [Demo/Sale].[Demo/SaleID] = Orders.[Demo/SaleID]) LEFT JOIN [Order Details] ON Orders.OrderID = [Order Details].OrderID) ON Products.ProductID = [Order Details].ProductID

WHERE (((Orders.OrdDeliveryCountry)="Austria" Or (Orders.OrdDeliveryCountry)="Belgium" Or (Orders.OrdDeliveryCountry)="Cyprus" Or (Orders.OrdDeliveryCountry)="Czech Republic" Or (Orders.OrdDeliveryCountry)="Denmark" Or (Orders.OrdDeliveryCountry)="Estonia" Or (Orders.OrdDeliveryCountry)="Finland" Or (Orders.OrdDeliveryCountry)="France" Or (Orders.OrdDeliveryCountry)="Germany" Or (Orders.OrdDeliveryCountry)="Greece" Or (Orders.OrdDeliveryCountry)="Hungary" Or (Orders.OrdDeliveryCountry)="Ireland" Or (Orders.OrdDeliveryCountry)="Italy" Or (Orders.OrdDeliveryCountry)="Latvia" Or (Orders.OrdDeliveryCountry)="Lithuania" Or (Orders.OrdDeliveryCountry)="Luxembourg" Or (Orders.OrdDeliveryCountry)="Malta")
AND (([Order Details].ProductID) Not Like "*Upgrade")
AND ((Orders.[Demo/SaleID])=2))
OR (((Orders.OrdDeliveryCountry)="Austria" Or (Orders.OrdDeliveryCountry)="Belgium" Or (Orders.OrdDeliveryCountry)="Cyprus" Or (Orders.OrdDeliveryCountry)="Czech Republic" Or (Orders.OrdDeliveryCountry)="Denmark" Or (Orders.OrdDeliveryCountry)="Estonia" Or (Orders.OrdDeliveryCountry)="Finland" Or (Orders.OrdDeliveryCountry)="France" Or (Orders.OrdDeliveryCountry)="Germany" Or (Orders.OrdDeliveryCountry)="Greece" Or (Orders.OrdDeliveryCountry)="Hungary" Or (Orders.OrdDeliveryCountry)="Ireland" Or (Orders.OrdDeliveryCountry)="Italy" Or (Orders.OrdDeliveryCountry)="Latvia" Or (Orders.OrdDeliveryCountry)="Lithuania" Or (Orders.OrdDeliveryCountry)="Luxembourg" Or (Orders.OrdDeliveryCountry)="Malta")
AND (([Order Details].ProductID) Not Like "*Repair")
AND ((Orders.[Demo/SaleID])=2))
OR (((Orders.OrdDeliveryCountry)="Austria" Or (Orders.OrdDeliveryCountry)="Belgium" Or (Orders.OrdDeliveryCountry)="Cyprus" Or (Orders.OrdDeliveryCountry)="Czech Republic" Or (Orders.OrdDeliveryCountry)="Denmark" Or (Orders.OrdDeliveryCountry)="Estonia" Or (Orders.OrdDeliveryCountry)="Finland" Or (Orders.OrdDeliveryCountry)="France" Or (Orders.OrdDeliveryCountry)="Germany" Or (Orders.OrdDeliveryCountry)="Greece" Or (Orders.OrdDeliveryCountry)="Hungary" Or (Orders.OrdDeliveryCountry)="Ireland" Or (Orders.OrdDeliveryCountry)="Italy" Or (Orders.OrdDeliveryCountry)="Latvia" Or (Orders.OrdDeliveryCountry)="Lithuania" Or (Orders.OrdDeliveryCountry)="Luxembourg" Or (Orders.OrdDeliveryCountry)="Malta")
AND (([Order Details].ProductID) Not Like "*Rpr")
AND ((Orders.[Demo/SaleID])=2))

OR (((Orders.OrdDeliveryCountry)="Holland" Or (Orders.OrdDeliveryCountry)="Poland" Or (Orders.OrdDeliveryCountry)="Portugal" Or (Orders.OrdDeliveryCountry)="Slovakia" Or (Orders.OrdDeliveryCountry)="Slovenia" Or (Orders.OrdDeliveryCountry)="Spain" Or (Orders.OrdDeliveryCountry)="Sweden")
AND (([Order Details].ProductID) Not Like "*Upgrade")
AND ((Orders.[Demo/SaleID])=2))
OR (((Orders.OrdDeliveryCountry)="Holland" Or (Orders.OrdDeliveryCountry)="Poland" Or (Orders.OrdDeliveryCountry)="Portugal" Or (Orders.OrdDeliveryCountry)="Slovakia" Or (Orders.OrdDeliveryCountry)="Slovenia" Or (Orders.OrdDeliveryCountry)="Spain" Or (Orders.OrdDeliveryCountry)="Sweden")
AND (([Order Details].ProductID) Not Like "*Repair")
AND ((Orders.[Demo/SaleID])=2))
OR (((Orders.OrdDeliveryCountry)="Holland" Or (Orders.OrdDeliveryCountry)="Poland" Or (Orders.OrdDeliveryCountry)="Portugal" Or (Orders.OrdDeliveryCountry)="Slovakia" Or (Orders.OrdDeliveryCountry)="Slovenia" Or (Orders.OrdDeliveryCountry)="Spain" Or (Orders.OrdDeliveryCountry)="Sweden")
AND (([Order Details].ProductID) Not Like "*Rpr")
AND ((Orders.[Demo/SaleID])=2))

ORDER BY Orders.ShipDate DESC;

View 5 Replies View Related

Forms :: Text Box Taking Value From Wrong Column?

Oct 1, 2013

I have a text box that is displaying a value from a table where the display control for the field in the table is a two row combo box. The text box on my form (I'm droping the text box on the form and manually changing the control source) is displaying the second column of the combobox where as I want the first column. If I drag the combobox from the field list onto the form it does show the expected first column (now if i change this to a text box in properties it shows the second column as well). Is there a way to change the text box to view the first column?

View 2 Replies View Related

What's Wrong With This IIF Expression

Nov 10, 2005

Hello,

I have added this IIF expression in the criteria in a query:

IIf([Forms]![Open_Form]![CLAMT_BET] Is Null;[Tbl_MainWeekly]![Credit limit]; Between [Forms]![Open_Form]![CLAMT_BET] And [Forms]![Open_Form]![CLAMT_and])

When the field CLAMT_BET is empty I get all the data which is what I want. However, when it is not empty, instead of having the "between....and" I get all the records which are at 0

Any idea will be aprreciated ?

Thanks

Cheers Dan

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

Help With Expression Suntax - What's Wrong With This?

Jul 25, 2005

Can y'all take a look at this expression and tell me what is wrong? I'm new at this and have found many variations on proper syntax when trying to use dlookup with a combo box. Access 2003 returns the error (#Error) Thanks.

=DLookUp("[Genus species]","[Species List]","[CommonName] = &forms![Bird Chase]![Combo15] &")

View 8 Replies View Related

Forms :: Expression To Change Color Of Text According To Date?

Jun 26, 2013

I am attempting to create an expression that will change the font to red if it is an overdue date. It will be on a form with the records showing.

My datebase is for entering, changing, and searching for information dealing with orientation dates, contacts, and associations. My data sheet holds the company name, employee name, date of orientation, due date (orientations are completed annually), contact employee, and status. I would like the date, when opening the form, to show red if it is past due. how to create an expresion to return the status as "Current" or "Overdue", as I am still unsure which method I want to use.

View 1 Replies View Related

Nz Returning Text Instead Of Number

May 24, 2007

hi all,

here's the dealio... i need perform an aggregate funtion off of a certain field, but it contains null values. i tried using Nz and an Iif IS NULL statement to get rid of the nulls. but both methods return the values as text. obviously, i can't get an Avg of these text values.

here's the two methods i tried:

Format(IIf([AvailTab].[Per00] Is Null,"1",[AvailTab].[Per00]),"Percent") AS Per01Test

Format(Nz([AvailTab].[Per00],"1"),"Percent") AS Per00

how can i return the data as a number?

thanks,
mj

View 4 Replies View Related

DCount In Calculated Text Box Returning NOTHING

Jun 9, 2005

I am trying to use DCount to count the number of record that = 0 for field checklistitem_1 in table 'Data Input'.

I firstly tried =DCount("[ChecklistItem_1]","Data Input","[ChecklistItem_1] = 0") but this returned nothing.

So I tried =DCount("*","Data Input") just to see if I could get something back and still nothing.

I double check the names are correct, dropping the quotation marks different combination of brackets and nothing every time.

Please help me

View 1 Replies View Related

Queries :: DLookup Returning Numeric Value As Text

Apr 19, 2013

I have a Dlookup which returns the correct value but returns the text of the instead of a numeric value. I have triple checked that the fields are all numeric. I suspect there is something wrong with my Dlookup syntax as it is my biggest weakness. In the following syntax what could be wrong?

DLookUp("SSER","TABSSS",[grosspay] & " Between [TABSSS].[Minrange] And [TABSSS].[Maxrange]")

View 4 Replies View Related

Modules & VBA :: Convert Column From Text To Dates Returning (Object Does Not Support This Method) Error

Jun 30, 2014

I am trying to format an excel spreadsheet through access, specifically trying to convert a column from text to dates (I receive the data in text format and need to translate it to dates).

Code:
Dim excelApp As Object
Set excelApp = CreateObject("Excel.Application")
excelApp.screenupdating = False
excelApp.Visible = False
Set excelWB = excelApp.workbooks.Open("Z:DataBasicSMData.xlsx")

[Code] ....

I'm no longer getting an error, but it isn't actually modifying the spreadsheet...

View 2 Replies View Related

Forms! Where Am I Going Wrong....

Jan 23, 2008

Hi,

frustration city over here.

for something that reads so simple, i cannot do it. why?

4 tables
Contacts
Authorizations
Payment Numbers
Payments

all tables are 1 to many relationships with referential integrity.
every contact can have many Authorizations
every authorization can have many payment numbers
many payment numbers can have many payments

all payments numbers created are based on the latest Authorization number.
a single payment number will have numerous payments listed.

i have tried forms with qry, forms with tbl, forms with forms, sub forms, sub sub forms. i can get so far but then everything stops linking together. ive tried VB ( barr it i am better with Excel!! ) to open forms, link forms.

story.
1. my main form will show the current contact & all details.

2. i click a button and want to make a payment to them.

3. a form should open and automatically create a new payment number with a subform ready to receive payment details in a continuous form layout. i can then either press an apply button on the main form to save or a cancel button to completely cancel the payment number.

after this, i wanted to add a button on this form to add a new authorization number and refresh but i need to get over this hurdle first.

Please Please Please can someone guide me? the rest of my project is based like this so if i can understand how this can be done, i can move forward to complete.


Any help would be graciously received so i can at least move in a direction rather than circles!!!!!


many thanks,


Nigel

View 11 Replies View Related

Inserting An Expression In A Text Box Of A Report Using VB.

Jun 27, 2005

Hi, I want to insert an Expression in a text box of a report using VB.

This is what I wrote in the code builder section of report header.
Me.totalBox.Value = strTotalExp

Me is the header section of the report.
totalBox is the textbox.
strTotalExp is the expression that I want to enter, it is a string.

How should I do this?

Thanks.

View 12 Replies View Related

Text Box Expression Inserted To Table?

Mar 13, 2012

I have a text box on my table form with the expression =([LINES]-[MISSED LINES])/[LINES] which gives me the results I want but I also want this total to go to the "On time %" column in my table.

View 3 Replies View Related

Text Box Expression Builder With Queries

Jan 9, 2012

I know how to do this in VB.NET ... I have a form with a combo box. I would like to create an "on change" event where it updates the text boxes on that same form depending on what's been selected in the combo box.

I don't know how to change the combo box's selected index so it defaults to the first item so there's no blanks/errors in my form.

So when the combobox contents is changed, I'd like a routine that updates all the text boxes kind of like this:

sub update()
TextBox = "SELECT * FROM Table_Name WHERE ID =" & Combobox.text
end sub

View 7 Replies View Related

Expression - Pulling A Number From A Text Box

Aug 8, 2012

I am trying to pull a number from a text box. I listed the expression for the box below. [Current Record] is a number and Count(*) is a number. I couldn't figure out what field gave me the total records so I did a count instead. If I want to pull the value from just the count portion, what expression would do that?

Code:
=[CurrentRecord] & " of " & Count(*)

Note the spaces on either side of "of"

View 6 Replies View Related

Forms :: Picking Up Wrong Record

Dec 6, 2013

I have a table called "Cities" which has only two fields; City & Province.I have connected it in a relationship with another table as "Include ALL records from 'Cities' and only those records from 'tblInstallations' where the joined fields are equal."I have put an "AfterUpdate" event which works and everything.

It is working fine and updates the province correctly.The problem is that is putting another city from same province in the "City" field even though I picked up different name.

View 6 Replies View Related

Extract Regular Expression From Text Field

Sep 5, 2007

I have a table with a text field (named Description), which may or may not contain an "ID Number", which is of the form [CHSV]#[A-Z][A-Z][A-Z]## - NB this is not necessarily at the beginning or the end, and will vary between records. For e.g.

"something C4CLE01"
"something H5STT02 Something else"

What I would like to do in a query is to extract just the ID number part and put that in a new field e.g.

"something C4CLE01" => "C4CLE01"
"something H5STT02 Something else" => "H5STT02"

So far I have considering LIKE, which is no good because it doesnt tell you where in the string the regular expression is, and INSTR doesnt work with regular expressions AFAIK.

Added bonus difficulty - I use the database as an external source for an Excel pivot table. I created a function (which I named JOBID) in VBA to do the above job easily enough i.e. I added a field "JOBID([Description])", but when I try to use the data in said pivot table, it says "Undefined function JOBID in expression". I have tried copying the function to the Excel workbook, but that doesn't work.

Im using Office 2003 if that makes any difference. Thanks in advance.

View 5 Replies View Related

General :: If Expression In Default Control Of Text Box

Oct 10, 2012

I would like to be able to put an if expression in the default control of a tx box.

I would like to say

if txtA = 0 then [Forms]![frmNewAppointment]![OrderTime] else [Forms]![frmAppointmentTreatmentItems]![TextA]+[Forms]![frmNewAppointment]![OrderTime]

Is it possible and am i close to doing it mysel?

View 3 Replies View Related

Modules & VBA :: Expression Builder IIF Not Recognizing Text

Jan 14, 2015

what's wrong with this iif statement?

=IIf([Details]="COST OF PRODUCT",[PerUnit]*[Quantity],0)

it keeps coming back with 0 even when the text says COST OF PRODUCT

I have also tried:
=IIf([Details]="COST OF PRODUCT*",[PerUnit]*[Quantity],0)
=IIf([Details] Like "COST OF PRODUCT",[PerUnit]*[Quantity],0) =IIf([Details] Like "COST OF PRODUCT*",[PerUnit]*[Quantity],0)

I'm using the expression builder to create it in a total box in the report footer, I have a box that gives me the total of the report using a sum and I need to show the cost of product separately to this as I need to use it in another calculation.

View 3 Replies View Related

Modules & VBA :: Text String Extraction - Expression Builder?

Jul 15, 2014

I'm currently in the process of moving from Excel to Access and am setting up a user table with 5 Fields (Full Name, First, MI, Last, Alias). I would like to only transfer the Full name and have the other field be calculated fields, so they automatically fill in. I was able to get the "Last" field to work, but the others are being tricky. Especially the "Alias" field which would need to take the first letter of the first name, MI letter and the entire last name, like (JPDoe).

The current format of my "Full Name" field looks like, (Doe, John P.) without the brackets of course. I'm new to Access, so I was trying to use the Expression Builder to do all of it, unless there is an easier way?

View 7 Replies View Related

Forms :: Wrong Focus When Switching Among Pages Of TAB Control

May 3, 2013

I have a form with a TAB control and four pages. Each control of each page has his TAB index set correctly (starting from 0 to n), some of controls are not enabled to be tabbed. The form's cycle is set on "Current page".

I have two kind of problems.

First: I am on the last control of the page, pressing TAB key the focus gets invisible. Press TAB key again and the focus moves on the first page's control. For each page happens this behaviour.

Second: clicking randomly on the TAB pages the focus is not always on the control with TAB index 0, but usually on the last.

I have read that clicking on a new page the focus should be automatically on the first control, but this does not happen in my experience.

View 9 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







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