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:
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.
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));
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.
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)
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
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.
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.
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.
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?
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
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
I would like to change the property of a text box to Visible and Required when a user chooses a specific value in a drop down box of a different text box. Is this possible using a macro or some other way?
I have a report that is looking up min and max quality specifications for a product. The table with the specifications has a Yes/No check box field for when the specs are defined as "Internal". So the table looks like Product/MinValue/MaxValue/Internal
I want the report to display "TEST AND RECORD" when the Internal box is checked where the MinValue and MaxValue (that are stored in the table) would be displayed otherwise.
I have a form I would like to validate input on. The field UpdatedResponsibilityCode can be updated but it can only have certain values based on the PaymentResponsibilityCode. Is there a way to force this validation?
If UpdatedResponsibilityCode = 4 then PaymentResponsibilityID can not equal 1
You will see it is a simple problem if you know what your are doing.
When entering the joining date I would like the Status to change automatically to Member and when the renewal date is reached I would like the status to automatically change to Renewal but I am unable to work out a formula for this.
Hi. I have a main table (with other tables related to it). It has the 255 max number of fields. (I know... But bear with me.)
ANyway, I need to change some field's size to smaller sizes. But if I try to change them, even 1 at a time, I get the cannot do because I have too many fields defined.
Hello. I'm triyng to change every field format in a Form each time I jump from one field to another. I want it to get grey and bold when it got the focus
I managed it with a GetFocus and Lost Focus for each field but whena form has a lot of fields it gets "a lot" of programing.
Is there a way of doing it another way, for instance On current
Thanks for all of the help you have already given me.
Here's another.
What I'm trying to do it get a field, which is a combo box, to pop up a warning when someone tries to change it. I'm trying to keep people from unknowingly change the name field of the time sheet. I only want the warning to show if the field being changed already has a name in it.
Here is what Ive tried.
Private Sub Employee_BeforeUpdate(Cancel As Integer) If Not IsNull(Me.Employee) Then MsgBox "Are You Sure?" End If End Sub
The warning works, but it shows up regardless of the field being empty or filled.
I'd like to have it so I get a msgbox using vbyesno to give the user a choice whether to keep the change or accept it.
Any help would be greatly appreciated. Thanks again!
I have a similar problem, I'm fairly new to ACCESS and am learning it is vastly different than EXCEL that we use (we are upgrading to ACCESS to track our "in" and "out". I have set up a ACCESS database to track our barge loading and pumping, on the delay we enter reason for the delay but if no delay occurs it is left blank. How can I get the field to change colors if information is entered and left alone if none is entered. Quote: Originally Posted by shamrog12 Make sure to dim recItem1Value and backg in the appropriate area
Try this: Code:<%recItem1Value = lcase(Recordset1.Fields.Item("RecItem1").Value)backg = ""Select Case recItem1Value Case "x" backg = " style=""background-color:red;"" " Case Else backg = ""End Select%><!-- whatever code here... //--><td<%=backg%> nowrap><input name="txtField1" type="text" onChange="RecUpdate value="<%=(Recordset1.Fields.Item("RecItem1").Value)%>" size="4"></td>