Form Change A Query Field?

Jul 11, 2012

Can a form change the field on a query?

Right now one of the tables in my query has multiple years across the top (as the fields), 2010, 2011, 2012, 2013. Each year contains different rates that get applied to labor hours.

I would like to know if there is a way to have a form change the field in my query. I have attached a word document showing print screens of what I mean.

View Replies


ADVERTISEMENT

Change Field In A Query By Form

Aug 5, 2006

Is the a way of changing the fields selected in a query by a form.

I have a form showing how many people need to do each module. Each textbox is populuted by a count from the table.

The idea is simply to avoid having 26 queries based on each module. Is there a way to have the field name changed via the form.

I have used the on dbl click event to pass the field name to a hidden field on the record. I just need to pass the data in the hidden field to the select query.

View 2 Replies View Related

Queries :: Change Query Field Based On A Form

Oct 29, 2013

I need a query's field to change to what is selected in a combo box.

Example,

I select product 1 in the combo box on a continuous form, after the update there is a requery. The form now displays the data from product 1.

I have tried putting [forms]![form1]![combo1] into the field box of the query. But this only makes the form display "product 1" in every row, it does not take any data from the table.

View 3 Replies View Related

Change Field Value On Change Of Other Field In Form

Apr 2, 2008

What I want to do is following.
In form ASSIGN(fields are takedate and inout) ,if TAKEDATE is different then 0 then set value of inout field to 1
My VBA knowledge is poor cause i dont think this should be hard

thanks in advance

View 8 Replies View Related

Field Change Query

Apr 16, 2008

All,

Is there a way to create a query to show when text in a specific field was changed?

View 2 Replies View Related

Change Field Facts In Query?

Oct 20, 2005

Lets say I have a table with the following columns:

Chainname
Storenumber
Storename
Revenue in value (sold goods in $)
Revenue in volume (sold goods in pieces or SKUs)
Month

I create an Append query where I use these fields from my table:

Chainname
Storenumber
Storename
Revenue in value (sold goods in $)
Month

What happends afterwards doesn't matter, but I what if I would like to change a field in my Append query to this:

Chainname
Storenumber
Storename
Revenue in volume (sold goods in pieces/SKUs)
Month

I can do that manually by opening the Append query and then change it in the field...But can I change it without actually opening the query. Lets say using a Form were I choose if I wanna use:

Revenue in value (sold goods in $)

or

Revenue in volume (sold goods in pieces/SKUs)

??

View 3 Replies View Related

Using VBA To Change The Name Of A Field In A Union Query

Feb 16, 2007

I have a table called LLD Import Table with the following fields in it.

FileNumber, LandDescription, Qtr1, Sec1, Qtr2, Sec2, Qtr3, Sec3, Qtr4, Sec4, Qtr5, Sec5

Data Example:
123456, T43 R2 W5M, S, 6
123457, T43 R1 W5M, SE, 18, SW, 17
123456, T43 R1 W5M, E, 19, E, 30, SW, 29, E, 31, NE, 18

What I have done so far is to create a Union query to create a new record with the file and land description repeating for each row where there is quarter and section data with the following code:

SELECT [LLD Import Table].[FileNumber], [LLD Import Table].[LandDescription], [LLD Import Table].Sec1 AS Section, [LLD Import Table].Qtr1 AS Quarter
FROM [LLD Import Table]
WHERE ((([LLD Import Table].Sec1) Is Not Null));
UNION
SELECT [LLD Import Table].[FileNumber], [LLD Import Table].[LandDescription], [LLD Import Table].Sec2 AS Section, [LLD Import Table].Qtr2 AS Quarter
FROM [LLD Import Table]
WHERE ((([LLD Import Table].Sec2) Is Not Null));
UNION
SELECT [LLD Import Table].[FileNumber], [LLD Import Table].[LandDescription], [LLD Import Table].Sec3 AS Section, [LLD Import Table].Qtr3 AS Quarter
FROM [LLD Import Table]
WHERE ((([LLD Import Table].Sec3) Is Not Null));
UNION
SELECT [LLD Import Table].[FileNumber], [LLD Import Table].[LandDescription], [LLD Import Table].Sec4 AS Section, [LLD Import Table].Qtr4 AS Quarter
FROM [LLD Import Table]
WHERE ((([LLD Import Table].Sec4) Is Not Null));
UNION
SELECT [LLD Import Table].[FileNumber], [LLD Import Table].[LandDescription], [LLD Import Table].Sec5 AS Section, [LLD Import Table].Qtr5 AS Quarter
FROM [LLD Import Table]
WHERE ((([LLD Import Table].Sec5) Is Not Null));

To give this result:

FileNumber, LandDescription, Quarter, Section
123456, T 43 R 1 W5M, NE, 18
123456, T 43 R 1 W5M, E, 19
123456, T 43 R 1 W5M, SW, 29
123456, T 43 R 1 W5M, E, 30
123456, T 43 R 1 W5M, E, 31
123456, T 43 R 2 W5M, S, 6
123457, T 43 R 1 W5M, SW, 17
123457, T 43 R 1 W5M, SE, 18

However the number of Quarters and Sections under a file changes, so next time I my table could have fields up to Qtr20 and Sec20 What I’d like to do is to create a function that will automatically change the # behind the field names (to replace the * in the example below) so that I don’t have to rewrite the Union Query each time. I’ve seen some code examples that can change the value, but don’t quite understand them enough to write one.

SELECT [LLD Import Table].[FileNumber], [LLD Import Table].[LandDescription], [LLD Import Table].Sec* AS Section, [LLD Import Table].Qtr* AS Quarter
FROM [LLD Import Table]
WHERE ((([LLD Import Table].Sec*) Is Not Null));

Your help would be GREATLY appreciated!

View 1 Replies View Related

General :: Change TXT Box To A Memo Field On A Form?

Dec 2, 2014

How do I change a txt box to a memo field on a form? (I need to allow for more than 255 chars...) I've already set the backend DB (sql server) to accept the many chars, and the linked table access see's the datatype as memo. But I can't figure out how to get a memo field on the form, or how to change the current txt box to a memo control to support the extra characters.

I've been looking for 20 minutes... I guess I never used a memo field before, since I can't find/see how to set this.

View 12 Replies View Related

Queries :: Change Field Format Within A Query

Sep 23, 2013

I'm having a format problem. I have a query (Q1) that, among other things format a date field as YYYYMM (Field1).

I have a second query (Q2) whose data source is Q1.

In Q2 I need to link Q1 to a table but Field1 is being reformatted as text (confirmed by running a make table query).

I want Field1 to be Number format to eliminate a mismatch error.

I know how to change the format of a field in a table using VBA but I cant seem to find a way of changing the format within a query.

View 2 Replies View Related

Queries :: Change Field Name In Pass Through Query

Feb 10, 2014

In a table of a SQL-Server 2008 I have a fieldname "Alter", the German word for age.

When sending a PT-qry to the server I get an error "Incorrect syntax near the keyword 'Alter'"

Even when I try to set "Select tblmytable.Alter as Age" I get the same error.

To change the fieldname is almost impossible, as there is to much code to change.

View 3 Replies View Related

Modules & VBA :: Change Value Of A Field In Append Query Using SQL?

Jan 25, 2015

I have a main form which does nothing except filter subforms through a cbo.

On the main form are two subforms. One shows top line data, the other shows a breakdown of the top line data, and are linked by an unbound textbox (it's how it works, and does so perfectly)

I'm running an append query to duplicate a record in the second form using vba/sql BUT... need to have one of the fields values changed based on a field on the parent table.

If Forms!frmmain!frmPost.Form.RecordsetClone.RecordCo unt > 0 Then
strSql = "INSERT INTO [tblposts] ( TopLineID, AccountID, TransDate, Cat, SubCat, Debit, Credit ) " & _
"SELECT " & lngID & " As NewID, AccountID, TransDate, Cat, SubCat, Credit, Debit " & _
"FROM [tblposts] WHERE TopLineID = " & Me.TopLineID & ";"
DBEngine(0)(0).Execute strSql, dbFailOnError
Else
MsgBox "Main record duplicated, but there were no related records."
End If

Credit and Debits are reversed as I want one to zero out the other.

In regards to the AccountID, I've tried allsorts and it's just not working... to the point I'm almost giving up and finding an alternative.

Whats the "Correct" syntax to attach a "WHERE" statement to the highlighted [AccountID]'s (which needs to be the value on AccountID on the Parent table)

View 1 Replies View Related

Forms :: How To Change 2 Field Names With VBA Code Within A Form

Nov 28, 2013

I have two text fields:

their names are :

field 1 ="txtfilter"
and
field 2: "text333"

How can i change the names of the two fields with vba code?

I need field 1 to get the name of field 2
and field 2 to get the name of field 1

This will be temporarily.

using access 2013

View 5 Replies View Related

General :: Error In ID Field Of Form - Cannot Add Or Change A Record

Aug 6, 2012

I'm setting up a college database. On my enrollment form i have the following fields

Enrolment_ID
Student_ID
Course_ID

I'm receiving the error in my Student_ID field. It's telling me a related record is required in my Student Table.

The drop down shows the student name/date of birth/Education number

But if i set it to just show the ID it works fine, is there a work around for this as it will make life a lot easier for the dropdown to display the student names rather than the ID?

The dropdown is based on a query i have of accepted students....

View 2 Replies View Related

Forms :: Change Default Way A Field Is Selected In A Form

Mar 2, 2015

Any way to change the default way a field is selected in a form so that it doesn't highlight all the text when you tab?I have the standard black text on a white background but when the whole field is highlighted it looks ugly and I think is quite difficult to read until you click into it.

View 3 Replies View Related

Change Text To Date/Time Field In A Query

Feb 7, 2008

I have created a table called - "Test"
The properties of the table is listed below

Table Name: Test
Field Name: ADMDAT2 (Text)
DISDAT2 (Text)
Operation Date (Date/Time)

I have written a query to populate a field where the Operation Date is between the ADMDAT2 and DISDAT2

Expr1: IIf([ADMDAT2] Is Null,"",IIf([Operation Date]>=[ADMDAT2] And [Operation Date]<=[DISDAT2],"Match"))

Unfornately it returns and ERROR message... I believe this may be because, the data type of the field, matching a Text with a Date/Time, I have rerun the query using a sample table where all the fields are Date/Time, and it work perfectly.

What i need help with how do i convert a text field into a Date/Time in a query?

So i can place that in the query before i populate the Test table. therefore it all should be date/time

thanks in advance

View 1 Replies View Related

Modules & VBA :: Dynamic Query Change Field Selections

Jun 25, 2014

I am trying to build a function that will create a dynamic query for a chart on a Subreport.I am not exactly sure I am going about this the right way, but I need the user to be able to change selected fields for use in the query. I have a form with 3 combobox controls for selecting options to change the SQL statement. So far my code only deals with one of these comboboxes for simplicity. There is a button to call my function. Currently, the function is setting hidden text box values based on the combo controls, but I'm not sure if this is redundant.

I am using this as my guide for building the sql, but I am having trouble picking up the values in my text boxes for use in the SQL. [URL] .....

Code:
Option Compare Database
Option Explicit

[code]...

how do I get a value from an unbound textbox on an unbound form into a string to use as sql? The value in the textbox is a number.

View 3 Replies View Related

Queries :: Create View (Query) With Only Change In Value For First Field

Jul 16, 2014

Need sorted Query to be used in a Listbox. The attachment shows a made-up view of the objective.

The first column shows the change in value, then blanks for the first column's next rows, until there is a change of value again.

I do something like this in Excel where the first change in value is bolded. This is to make a list box more readable.

View 13 Replies View Related

Update Query To Change Display Value Part Of Hyperlink Field

Nov 11, 2007

Given a table field that is a hyperlink type.
I need an Update Query to set all records of that table so that the Displayed Value part of the hyperlink field (not the Address part) is set to a particular value.
Any ideas how?
Thanks.

View 1 Replies View Related

Queries :: Field In Table Doesn't Change When Edited From Query

Mar 29, 2013

Users are viewing a record on a form that gets it's data from a query. I want to make it so that if they edit that record from that form, a last updated field will timestamp the date/time that the record was edited. I added a lastupdated to the source table which of course adds it to the query and so it's on the form.

But whenever i access the form and change something, the lastupdated only shows the time the record was created (which is from a different form based directly on the table). Whenever I edit any other field data in that query based form it changes in the table. Why not the Lastupdated?

View 2 Replies View Related

Change Field Background Color Based On Query Results

Jun 24, 2014

I would like to change the background color of a field that is the result of a Unique Values query. I am trying to get a list of invoices where all the line items are approved. I can't seem to get it to work the way I want because if even one invoice line item is approved it will show up as approved.

Is there a way to change the background color of the invoice field to red if ANY of the Approved line items are = False

View 7 Replies View Related

Create A Query With Derived Field Based On Each Change In Recordset

May 5, 2013

I need to come up with a way to derive field X (see below) in a query.

For each change in field A, Set X=1
For each change in field B, X=X+1

The below table shows what the query results should look like.

A
X
B

[code]....

View 2 Replies View Related

Modules & VBA :: Change Formatting Of Unbound Text Field On Continuous Form

Apr 16, 2015

I have a continuous form with a text field that says "Select". There are two other fields, one of which is Brand. When the Brand Combo box has nothing in it I want the text box to appear (instructing the user to select a Brand) But once the user selects a Brand and goes to the next records, I would like the "Select" in only that record to become not visible. I tried conditional formatting but can't apply that to an unbound control ( or at least it is grayed out when I select the text box) and any other possible solutions I have found changes all of the selects - not only the one in the changed record.

View 7 Replies View Related

Forms :: Change Datasource Of Form Field Based On Current Year

Nov 12, 2014

I have a little "y2k issue".

My DB has many (!) forms that are based on Crosstabs queries. The headers are years, and therefore my formfields has controlsources like 2014, 2015 and so on.

Example:

The table it comes from looks something like this:

tblProject
Project: Myproject
Value: 1000
EndYear: 2014

The crosstab then takes the EndYear as a coloumn header. Then my forms use these fields, now named 2014, 2015, 2016 .... and give me a nice looking table showing the accumulated "end" for multiple projects.

The problem is when the year changes after 31/12, all fields must manually be changed. This means I have to manually change 2014 to 2015, 2015 to 2016 and so on in all of my formsfields controllsource.

I have played around to find a way to change the source of the field, and hoped I could say something like =year(now()) and for the next year say =year(now())+1 but this only returns that year as a value, and not as a controlsource...

The query functions nicely (ive changed the system time, and it has no issues with this structure), but the forms source is still in the previous year, and returns and error (of course).

When the year changes past new years eve, so will the headers (fieldname) change... but how to make the form change fieldsource?

View 3 Replies View Related

Queries :: Change Time Portion Of Datetime Field In Update Query?

Sep 12, 2013

I have some incorrect time entries in a column that I need to fix with an update query.

So, 04/11/2013 08:00:00 needs to be changed to 04/11/2013 09:00:00

View 5 Replies View Related

Forms :: Continuous Form - One Field Change Background Color / Current Record

Jul 28, 2014

in a continuous form i want to click on one record and have the one field change the background colour to highlight it. When I use the code: Field. BackColor = vbYellow it changes the background on all the records. Is there a code to say only for the record with focus?

View 1 Replies View Related

General :: Comment History Field To Appear On A Form - Change Sort Order Of Results

Aug 28, 2013

I have after much stress gotten my comments history field to appear on a form.

The following code gives me what I needed

Code:
=ColumnHistory([RecordSource],"LastUpdateBy","[ID]=" & Nz([ID],0))

I have only one simple thing left, that is perplexing to say the least.

Some comment fields will be many short notes, spread over time.

My desire is to change the sort order of the results so the most recent (rather than the initial) comment is at the top.

View 5 Replies View Related







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