Queries :: Remove GROUP BY Line And Stick Semicolon At End Of Previous Line

Jun 25, 2013

Here's the statement

Code:

sqlfinal = "SELECT Employees.ID, Employees.Name "
sqlfinal = sqlfinal & "FROM ((qryDeptVBA INNER JOIN qrySkillVBA ON qryDeptVBA.ID = qrySkillVBA.ID) "
sqlfinal = sqlfinal & "INNER JOIN Employees ON qryDeptVBA.ID = Employees.ID) "
sqlfinal = sqlfinal & "INNER JOIN qryAreaVBA ON Employees.ID = qryAreaVBA.EmpID "
sqlfinal = sqlfinal & "GROUP BY Employees.ID, Employees.Name;"

If i simply remove the GROUP BY line and stick the semicolon at the end of the previous line (.EmpID; ) it works just fine. How is adding a group by line causing an error?I tried adding another parenthes at the beginning ((( and ending the joins as EmpID); and that failed with the exact same error.

View Replies


ADVERTISEMENT

Forms :: How To Get Values From Line Items Form Inserted Into QUOTE LINE

Jun 5, 2014

I have a main form with 3 sub forms. The main form is tied to a table called QUOTES_MASTER. The first sub form is tied to a table called QUOTE_ LINE_ ITEMS_DIRTGLUE. It calculates the subtotal when selecting items. The relationship is one-to-many linked on QUOTE_ID.

The second sub form adds up total of all line items and is not tied to a table.The third sub form adds ESTIMATED FREIGHT to the PRODUCT TOTAL and is not tied to a table. how to get the values from the line items form inserted into the QUOTE_LINE_ITEMS_DIRTGLUE table as they are added.

I also want to insert the total value from ESTIMATED DELIVERED into the LINE_TOTALS field in the table QUOTES_MASTER.I tried this code on the product total sub form but it doesn't do anything and there are no errors:

Private Sub PROD_SUB_AfterUpdate()
DoCmd.RunSQL "UPDATE QUOTE_LINE_ITEMS_DIRTGLUE SET QUOTE_LINE_ITEMS_DIRTGLUE.SUBTOTAL = Me.PROD_SUB WHERE QUOTES_MASTER.QUOTE_ID = " & Me.QUOTE_ID

View 6 Replies View Related

Modules & VBA :: Read CSV Transaction File Line By Line And Add Correct Transactions To Access Table

Nov 29, 2014

I have a module which reads a CSV transaction file line by line and adds the correct transactions to an access table and places the wrong ones in a logfile.Now some transactions are rejected twice there is even one rejected six times. Whereas one wrong transaction is processed only once. I am certainly overlooking something obvious in the logic but what. Here is the relevant code.

Code:

Function ImportCSVForConfederation(inputCSV, ORG)
Dim TNO As Integer, TACT As Integer, TABLE As String, TLINE As String, I As Integer, J As Integer, K As Integer
Dim FLD1 As String, FLD2 As String, FLD3 As String, FLD4 As String, LogFile As String, LogPath As String
Dim Lim As String, ITNO As Integer

[code]....

View 8 Replies View Related

Need To Remove Line That Prints From Form...

May 26, 2006

I am creating a form that is a letter. This letter will get printed off a lot. A line at the bottom of the sheet makes it look tacky. I am told this line prints on our other databases also. How do you get rid of it? Our company uses access 97 :mad:

View 6 Replies View Related

Modules & VBA :: How To Import Text File Line By Line

Nov 18, 2014

I am having a little difficulty with my importing in Access. Every time I import my text file, the lines will be jumbled. I have been reading up and I found this recordset code that seems to be what I need:

Code:
Dim strLine As String
Dim intLineNum As Integer
Dim MyDB As DAO.Database
Dim rst As DAO.Recordset
Open "C:TestTest.txt" For Input As #1
Set MyDB = CurrentDb
Set rst = MyDB.OpenRecordset("tblResults", dbOpenDynaset)
CurrentDb.Execute "DELETE * FROM tblResults", dbFailOnError 'Clear tblResults

[code]....

Basically, this code will extract data from the text file as long as it fulfills the Mid$ criteria. Here's where my problem comes. Each line in my text file is of different lengths and I have to capture the entire line.

I think using the Left$ function would work, but I don't know how to determine the character count such that the entire line of text would be inserted into the table.

Another difference between what I need and the code above is that, I am required to store each line into each row of my table, meaning

Line 1 is placed in Row 1 Column 1
Line 2 is placed in Row 2 Column 1
Line 3 is placed in Row 3 Column 1
.
.
.
Line X is placed in Row X Column 1.

View 14 Replies View Related

Forms :: Cannot Remove Unknown Line When Creating Form

Jun 24, 2014

I have created a form and insert, delete some columns, controls in layout view. When all 's completed, i saw a dark vertical line on top right of the last colulmn but i could not delete it. I deleted column, set property but they all did not work. What i have to do now? Below is a screen capture from my situation.

View 5 Replies View Related

General :: Code To Remove Line Breaks In Table

Jun 20, 2014

I programming a eBay upholder, and having an issue with the description, as there cant be any line breaks in the column. I have little knowledge of Vba programming. I think I can use the replace command to change the line breaks to spaces.

View 4 Replies View Related

Forms :: No Line Only Marker In Line Graph

Oct 18, 2014

I can change multiple things on a line graph with VBA.

Me.Graph47.chartType = GraphType ' take 65 for line
with me.graph47
.SeriesCollection(1).border.Color = vbblue ' change the line color
.SeriesCollection(1).border.Weight = LineWeight ' change the line weight to for example 3
.SeriesCollection(2).MarkerSize = MarkerWeight ' Change the marker weight, for example 4
.SeriesCollection(2).MarkerBackgroundColor = vbblue ' Change the marker color,
.SeriesCollection(2).axisgroup = 2 ' put this series on the secondary axis
end with

SeriesColection(1) is line with markers. This is correct.But now I want the seriescollection(2) without line, so only the markers. I cheched the MSDN site from Microsoft. The Excel trick with the macro does not work for me.how to hide the line with VBA for only SeriesCollection(2) in Access?

View 1 Replies View Related

Reports :: Subtracting From Previous Line In Report To Make Running Total

Jun 16, 2014

I have a database and one of the functions is to track the purchase of fuel. Part of purchasing fuel is registering what the current odometer reads. My query gets the Vehicle ID, Date of Transaction and Odometer reading. I want to show a report that shows how many miles the vehicle is has traveled for a certain amount of time. If it's for 2013 then I'll put the criteria for 2014 in the date. This will give me a list of all vehicles and their odometer readings. I then sort the date by ascending.

In the report I group on vehicle ID and then I want to show all their transactions and add up how many miles were driven.

Vehicle 1

1/2/201
1/5/2013
1/15/2013
ETC...
Total Miles Driven in 2014: XXXXXX

View 1 Replies View Related

Queries :: Add Textbox Value To Each Line Of Insert

Nov 20, 2014

I'm trying to set up a data import function as follows: The user fills out a form, generating an entry in the Orders table. After pushing a button, line item data will be imported from an excel spreadsheet. I've got most of this working- I have a temp table that gets cleared out and then populated from the excel spreadsheet which is then deleted, all working fine. My hangup is when I try and get the line item data out of the temp table. I need to append the Order unique ID from the textbox on the form to each line item. Here's the select statement part of the insert into:

SELECT Forms!frmOrder!OrderID AS OrderID, ItemsID, NumUsed
FROM tblTempOrder

This gets the line items fine, but puts an Ankh symbol as the OrderID for each line item.

View 2 Replies View Related

Queries :: How To Add A Text Line To A Query Field

May 18, 2013

I have a combo box that gathers data based on a query. Is it possible to add a line of text to be displaed every time i pull down the box?

For example I have:

Data1
Data2
Data3

I would like to have:

Not In List (the added txt)
Data1
Data2
Data3

View 2 Replies View Related

Reports :: How To Take Two Separate Queries To Create 2 Line Graph

Nov 21, 2014

I want to be able to take two separate queries to create a 2 line graph. Also to be able to spice the graphs up some. The ones I have done, single line, even seems dull.

View 7 Replies View Related

Queries :: Function To Output Line Numbers In A Query - YTD

Apr 18, 2014

Is there a built in function which can be used to create line numbers in a query?

I've written a query to calculate year to date (YTD) points for yachts in a series of races and sorted it in descending order - so yacht 1 is coming first, yacht 2 is coming second etc. I'm looking for a way to add sequential numbering (starting at one and increasing by one for each line) into the query to represent their YTD places. Or this this something that should be left to the report which uses the query?

View 1 Replies View Related

Queries :: Creating Query With Single Line Per Employee

Mar 28, 2013

I currently have a database that has the following tables:

t_Employees
t_Cost_Centers
t_Changes

The [t_Changes] tracks what cost centers the employee is in with a start date and end date:

Change_ID
Employee_ID
Cost_Center_ID
Start_Date
End_Date

I want to run a query that will show a single line per employee, and different columns for each of the cost centers the employee was in. If the employee was in 3 different cost centers, the query would have 4 columns (1 for the employee, 1 for the first cost center, 1 for the second cost center, 3 for third cost center).

I saw another thread to linked to a concatenate example by Allen Browne, but that places multiple values in a single cell. I want different columns per cost center.

View 2 Replies View Related

Queries :: Query To Show As A Single Line Item

Apr 8, 2013

Access Database in which i download the table from an Excel file.I am looking to create a query with certain criteria but did not have any luck recently.

1) I will need the query to show <Short code> that are only unquie to Korea.That means shortcode with a count of 1 belonging to Korea only.

2) I will need the query to show as a single line item <Shortcode> that appears two times under the country Korea. For example short code CB01406 is shown as two rows, i will like it to only show as a single row.

3) For all other shortcodes which exist in China as well as in Korea or China only. I will like them to be hidden in the query. That means not shown at all.

View 7 Replies View Related

How To Enter Commands In Command Line To Type Queries

Oct 3, 2014

I have had my 4th SQL/APP Dev lab class, however I missed the 5th.

Our 5th lab was .

1. Create 3 tables, populate with given data and create relationships. 'Customer, Invoice, Payment'

2. We were given 8 queries to try do, we had to come up with which commands would be used.

I have no 1 completed.

As for no 2.. we are still learning all the commands, so the lab here is for us to find what commands we think will be used. I have researched and have them all 6 queries we have to run.., I have all those commands written out on paper which I think are answers..how to find the command line to test them.

I'm using Access 2007 on Windows 7.

View 1 Replies View Related

Queries :: Average Price Of Last 5 Line By Items By Recent Date

Mar 4, 2015

Any way to filter the average price of of a Product within the last 5 occurences (Line Items). It would pull a week back so WHERE: Between Now()-7 and Now(). Example:

Code:
PARTID | Price | Date
--------------+-------------+---------
111223344 | 5 | 3/1/2015
111223344 | 7 | 3/2/2015
111223344 | 8 | 3/4/2015
111223344 | 10 | 11/22/2014
111223344 | 20 | 10/1/2014
111223355 | 5 | 2/5/2015
111223355 | 6 | 2/1/2015

to:

What I want:

Code:
PARTID | avgPrice | MinDate
--------------+----------------+-------------
111223344 | 10 | 10/1/2014
111223355 | 5.5 | 2/1/2015

View 4 Replies View Related

Queries :: Crosstab Query That Keeps Each Contract On One Line And Separate Fields For Each Contact

Jun 4, 2014

I have two tables, and I'm trying to create a crosstab query...I think. One table is Contracts, one is Contacts. Each contract could have multiple contacts, but they are numbered (1, 2, 3...etc.) based on importance. I want to create a query that keeps each contract on one line, and separate fields for each contact and each field of the contact. So a contact will have Title, First, Last, Address, etc. So I want my query to show as follows:

Code:
Contract-----Title1-----First1-----Title2-----First2
ContractX Mr. James Mrs. Sally

I of course need this to be dynamic, so if a contract has 9 contacts, there are fields up to Title9, First9, etc.

View 7 Replies View Related

SQL Line (Not Like)

Jun 20, 2005

I have the following code to display what choice I make on a drop down box:

Private Sub cboMajorLocation_AfterUpdate()

Select Case Me.cboMajorLocation.Value

Case 1
Me.lstPC.RowSource = "SELECT DISTINCTROW tblHardware.HardwareID, tblHardware.Name, tblHardware.Assignment, tblHardware.Location, tblHardware.Description FROM tblHardware WHERE (((tblHardware.Location) Like '*') And ((tblHardware.Type) = 'PC')) ORDER BY tblHardware.Name, tblHardware.Assignment, tblHardware.Location, tblHardware.Description;"
Case 2
Me.lstPC.RowSource = "SELECT DISTINCTROW tblHardware.HardwareID, tblHardware.Name, tblHardware.Assignment, tblHardware.Location, tblHardware.Description FROM tblHardware WHERE (((tblHardware.Location) Like 'FTM*') And ((tblHardware.Type) = 'PC')) ORDER BY tblHardware.Name, tblHardware.Assignment, tblHardware.Location, tblHardware.Description;"
Case 3
Me.lstPC.RowSource = "SELECT DISTINCTROW tblHardware.HardwareID, tblHardware.Name, tblHardware.Assignment, tblHardware.Location, tblHardware.Description FROM tblHardware WHERE (((tblHardware.Location) Like 'CS*') And ((tblHardware.Type) = 'PC')) ORDER BY tblHardware.Name, tblHardware.Assignment, tblHardware.Location, tblHardware.Description;"
Case 4
Me![lstPC].RowSource = "SELECT DISTINCTROW tblHardware.HardwareID, tblHardware.Name, tblHardware.Assignment, tblHardware.Location, tblHardware.Description FROM tblHardware WHERE (((tblHardware.Location) Like 'PQL*') And ((tblHardware.Type) = 'PC')) ORDER BY tblHardware.Name, tblHardware.Assignment, tblHardware.Location, tblHardware.Description;"
Case 5
Me![lstPC].RowSource = "SELECT DISTINCTROW tblHardware.HardwareID, tblHardware.Name, tblHardware.Assignment, tblHardware.Location, tblHardware.Description FROM tblHardware WHERE (((tblHardware.Location) Like 'Savage*') And ((tblHardware.Type) = 'PC')) ORDER BY tblHardware.Name, tblHardware.Assignment, tblHardware.Location, tblHardware.Description;"
Case 6
Me![lstPC].RowSource = "SELECT DISTINCTROW tblHardware.HardwareID, tblHardware.Name, tblHardware.Assignment, tblHardware.Location, tblHardware.Description FROM tblHardware WHERE (((tblHardware.Location) Like 'Retail*') And ((tblHardware.Type) = 'PC')) ORDER BY tblHardware.Name, tblHardware.Assignment, tblHardware.Location, tblHardware.Description;"

End Select
End Sub

What I need to know is how to make a statement that you can put in where you want it to display all but take out certain parts of it. Example: On "Case 3" it displays everything starting with "CS*" I want it to not display certain items like "Retail*", & "FTM*" & "PQL*" & "Savage*"

Any help for this statement would be great thanks

View 4 Replies View Related

End Of The Line

Jun 29, 2005

When writing a long line of code, I seem to recall there is a method of stating a new line, trouble is I cant remember what it is. I belive its something like an underscore. Can anyone help please?

View 1 Replies View Related

Next Line VBA

Mar 18, 2008

I am typing in a long SQL string and seem to hit a character line limit in VBA...

How do I programmatically return to the next line and have to code continue to read the SQL String?

I need to add more fields and this is too long..

View 4 Replies View Related

Line Break

Oct 17, 2005

How Can I remove line breaks in a string.

View 6 Replies View Related

How To Run It From Command Line?

Jul 20, 2007

I have a vba module call runme with this code

Option Compare Database
Sub makequery()
Dim db As DAO.Database
Dim qry As DAO.QueryDef
Dim rs As DAO.Recordset
Dim fld As DAO.Field


Dim XlApp As Excel.Application
Dim xlwb As Excel.Workbook
Dim xlws As Excel.worksheet
Dim xlrn As Excel.Range

Dim x As Integer


Set db = Access.CurrentDb
Set qry = db.QueryDefs("q1")
Set rs = qry.OpenRecordset

Set XlApp = New Excel.Application
XlApp.Visible = True
Set xlwb = XlApp.Workbooks.Add
Set xlws = xlwb.ActiveSheet

x = 1
For Each fld In rs.Fields
xlws.Cells(1, x).Value = fld.Name
x = x + 1
Next fld

Set xlrng = xlws.Cells(2, 1)
xlrng.CopyFromRecordset rs
xlws.Columns.AutoFit
rs.Close
qry.Close



qry.Close


End Sub


I can run it from vb eidit interface by hitting run.
How can I run it from command line?

I tried "msaccess.exe" "C:Documents and SettingsjzhuMy Documents est.mdb" /Excl /X "runme"
But it does not seems to work.

THX.
Jeff

View 4 Replies View Related

Skip A Line

Oct 20, 2005

In query:

I set the input parameters:

enter: [Please enter the value:]

After running, it shows "Please enter the value:"
This one I know

How can I make 2 lines showing

"Please enter the value:
eg. 0506:

enter: [Please enter the value: & vbcrlf & eg. 0506:]

It doesn't work.

Please let me know about it. Thanks.

View 1 Replies View Related

Line Breaks

May 16, 2007

I'm not sure if this is the right section for this question, but not sure where else to ask it.

We have a database and a query that is run that creates a table for a webpage.

The webpage (created in FrontPage) displays the info we need, but what we have 1 field that we would like to have display in a certain way. What we would like is, instead of having this 1 field string all the words out in a row.
For example:
word 1 word 2 word 3

Is there something we could either do in the query or within the webpage, that will force each word to a new line within it's table cell on the webpage

So would look something like this.
word1
word2
word3

it makes it easier to read on the webpage.

View 3 Replies View Related

Last Line Query

Aug 23, 2007

Hoping someone can help!:(

I have a table in access which holds interest rates details, and a query that displays the latest interest rate entered into the table (on the last line) by using the Last option in the Totals field.

The problem is that when I enter any new data into the table the query doesn't see this and continues to display the data which is now on the second to last line. The query for some reason just doesnt seem to notice the new last line.

Is there a solution to this so that it shows the new last line?

Thanks is advance!

View 1 Replies View Related







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