I have managed to get the following segment of code to gather information, from two tables (ItemINDEX, and ItemQOH) and export the results to an Excel file with a predefined name.
However, what I want to do is only export those Items that begin with "CX". - Private Sub Canwel_Export_Click()
-
On Error Resume Next
-
Dim QRY As DAO.QueryDef
-
DoCmd.Hourglass True
-
'MsgBox fOSUserName, vbOKOnly
-
DoCmd.SetWarnings False
-
Set DB = CurrentDb
-
-
DoCmd.DeleteObject acQuery, "ITEM"
-
strSQL = "SELECT ItemQOH.Item, ItemINDEX.CustNo, " _
-
& "[ItemQOH]![Beg_Bal]+[ItemQOH]![QTY_IN]-[ItemQOH]![QTY_OUT] AS End_Bal " _
-
& "FROM ItemINDEX INNER JOIN ItemQOH ON ItemINDEX.Item = ItemQOH.Item " _
-
& "ORDER BY ItemQOH.Item;"
-
'MsgBox strSQL, vbOKOnly
-
Set QRY = DB.CreateQueryDef("ITEM", strSQL)
-
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "ITEM", "C:\Documents and Settings\" _
-
& "" & fOSUserName & "\My Documents\Canwel " _
-
& "" & Year(Date) & " " & Month(Date) & " " & Day(Date) & ".xls", True
-
Application.FollowHyperlink "C:\Documents and Settings\" _
-
& "" & fOSUserName & "\My Documents\Canwel " _
-
& "" & Year(Date) & " " & Month(Date) & " " & Day(Date) & ".xls", , , False
-
Set QRY = Nothing
-
DoCmd.DeleteObject acQuery, "ITEM"
2 2014
Have a look in Access Help at the Left() function.
Welcome to Bytes!
Linq ;0)>
Have a look in Access Help at the Left() function.
Welcome to Bytes!
Linq ;0)>
Thank you, that did the the trick!
And thank you for the welcome. :-)
Sign in to post your reply or Sign up for a free account.
Similar topics
by: CSDunn |
last post by:
Hello,
I have a problem with field filtering between an Access 2000 Project form
(the application is called CELDT), and the report that shows the results of
the filter. Both the form and the...
|
by: Brian Newman |
last post by:
I've got what is actually a triple-layer nested form. That part works
fine. I've got the first subform related by the right key field to
the main form, then I've got the second subform related to...
|
by: Daveyk0 |
last post by:
Hello there,
I have a front end database that I have recently made very many changes
to to allow off-line use. I keep copies of the databases on my hard
drive and link to them rather than the...
|
by: jquest |
last post by:
Hi Again;
I have had help from this group before and want to thank everyone,
especially PCDatasheet.
My database includes a field called HomePhone, it uses the (xxx)xxx-xxx
format to include...
|
by: John Boy |
last post by:
Hi,
Can anyone help. This is really doing my nut in. 3 years ASP exp. and
now doing .DOT which is a step in the wrong direction.
Basically I am left with the code of a guy who has left. When I...
|
by: Ron S |
last post by:
After days of searching I finally an example that would work with my application, the only problem is after entering all of the code it is not working. Would someone be kind enough to take a look at...
|
by: robert maas, see http://tinyurl.com/uh3t |
last post by:
I'm working on examples of programming in several languages, all
(except PHP) running under CGI so that I can show both the source
files and the actually running of the examples online. The first...
|
by: DeanL |
last post by:
Hi all,
I'm trying to set up a query that runs from a command button on a form
(simple enough so far), what I want the query to do is take values
from the fields on the form (seven fields in...
|
by: Abedin |
last post by:
I have 9 digits in form of "111020402". Then I have another 9 digits
in form of "111020403". I have 100,000 records of these two 9-digit
numbers.
I want to filter this as follows:
District:...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |