hi,
I have a query that visualizes me, according to some criterions from
me inserted, name , Surname , Address , phone
ok..
Now, through a button, positioned in a Form,
I have to only export from this query the field telephone in a text
file
the name of the text file I would like to choose me...
the text file example:
345368998756
345894614542
168416616464
165445648250
they will have to appear a telephone number on every line without any
; or "
as in the example that I have done here above..
can someone help me? some example of code?
thanks
alexia
i'm access newbie.....
[I am desperate] 12 7531
"alessia" <al************ *@yahoo.it> wrote in message
news:gv******** *************** *********@4ax.c om... hi, I have a query that visualizes me, according to some criterions from me inserted, name , Surname , Address , phone ok..
Now, through a button, positioned in a Form, I have to only export from this query the field telephone in a text file the name of the text file I would like to choose me...
the text file example:
345368998756 345894614542 168416616464 165445648250 they will have to appear a telephone number on every line without any ; or " as in the example that I have done here above.. can someone help me? some example of code? thanks alexia i'm access newbie..... [I am desperate]
Create a new query "qryExport" which is based on your first query but
selects only the phone number. Then, if the button on your form is named
'cmdExport' the code might be as shown below. Note that if you need a
better way to select the export file path, then there is code for this too.
Private Sub cmdExport_Click ()
On Error GoTo Err_Handler
Dim strPath As String
strPath = InputBox("Enter file path", , "C:\Shared\Test .txt")
If Len(strPath) = 0 Then Exit Sub
DoCmd.TransferT ext acExportDelim, , "qryExport" , strPath
MsgBox "Done", vbInformation
Exit_Handler:
Exit Sub
Err_Handler:
MsgBox Err.Description , vbExclamation, "Error No: " & Err.Number
Resume Exit_Handler
End Sub
Il Fri, 10 Oct 2003 08:06:24 +0000 (UTC), "Fletcher Arnold"
<fl****@home.co m> ha scritto: "alessia" <al************ *@yahoo.it> wrote in message news:gv******* *************** **********@4ax. com... hi, I have a query that visualizes me, according to some criterions from me inserted, name , Surname , Address , phone ok..
Now, through a button, positioned in a Form, I have to only export from this query the field telephone in a text file the name of the text file I would like to choose me...
the text file example:
345368998756 345894614542 168416616464 165445648250 they will have to appear a telephone number on every line without any ; or " as in the example that I have done here above.. can someone help me? some example of code? thanks alexia i'm access newbie..... [I am desperate] Create a new query "qryExport" which is based on your first query but selects only the phone number. Then, if the button on your form is named 'cmdExport' the code might be as shown below. Note that if you need a better way to select the export file path, then there is code for this too.
Private Sub cmdExport_Click ()
On Error GoTo Err_Handler
Dim strPath As String
strPath = InputBox("Enter file path", , "C:\Shared\Test .txt")
If Len(strPath) = 0 Then Exit Sub
DoCmd.TransferT ext acExportDelim, , "qryExport" , strPath
MsgBox "Done", vbInformation
Exit_Handler : Exit Sub
Err_Handler: MsgBox Err.Description , vbExclamation, "Error No: " & Err.Number Resume Exit_Handler
End Sub
thanks! you are kind.. I immediately try the code that you have given
me...
it excuses my bad English... I am Italian
good day
Il Sat, 11 Oct 2003 08:48:59 GMT, alessia <al************ *@yahoo.it>
ha scritto: Create a new query "qryExport" which is based on your first query but selects only the phone number. Then, if the button on your form is named 'cmdExport' the code might be as shown below. Note that if you need a better way to select the export file path, then there is code for this too.
Private Sub cmdExport_Click ()
On Error GoTo Err_Handler
Dim strPath As String
strPath = InputBox("Enter file path", , "C:\Shared\Test .txt")
If Len(strPath) = 0 Then Exit Sub
DoCmd.TransferT ext acExportDelim, , "qryExport" , strPath
MsgBox "Done", vbInformation
Exit_Handle r: Exit Sub
Err_Handler : MsgBox Err.Description , vbExclamation, "Error No: " & Err.Number Resume Exit_Handler
End Sub
OK, work! great! thanks Fletcher!
however when I open the created text file
the telephone numbers come me this way
"33323214154163 85"
"51564684815654 84"
how do I do for eliminating the " "??
I would like only the telephone number in this way
1515645166544
1454468468154
have a good day!
"alessia" <al************ *@yahoo.it> wrote in message
news:k2******** *************** *********@4ax.c om... Il Sat, 11 Oct 2003 08:48:59 GMT, alessia <al************ *@yahoo.it> ha scritto:
Create a new query "qryExport" which is based on your first query but selects only the phone number. Then, if the button on your form is
named'cmdExport' the code might be as shown below. Note that if you need a better way to select the export file path, then there is code for this
too. Private Sub cmdExport_Click ()
On Error GoTo Err_Handler
Dim strPath As String
strPath = InputBox("Enter file path", , "C:\Shared\Test .txt")
If Len(strPath) = 0 Then Exit Sub
DoCmd.TransferT ext acExportDelim, , "qryExport" , strPath
MsgBox "Done", vbInformation
Exit_Handle r: Exit Sub
Err_Handler : MsgBox Err.Description , vbExclamation, "Error No: " & Err.Number Resume Exit_Handler
End Sub
OK, work! great! thanks Fletcher!
however when I open the created text file the telephone numbers come me this way
"33323214154163 85" "51564684815654 84"
how do I do for eliminating the " "??
I would like only the telephone number in this way
1515645166544 1454468468154
have a good day!
There are a number of ways to do this. Perhaps the easiest is:
1. Select qryExport in the database window.
2. From the menu at the top choose File>Export
3. Select filename and type = text then press Export
4. On this screen you can press "Advanced"
5. Set up your options here - especially change text qualifier from " to
none
6. Choose Save as ..."QryExport Export Specification"
7. Finish export
You can now change the code from:
DoCmd.TransferT ext acExportDelim, , "qryExport" , strPath
to:
DoCmd.TransferT ext acExportDelim, "QryExport Export Specification",
"qryExport" , strPath
If this is too difficult I could write some code to do this for you.
Fletcher
Il Sat, 11 Oct 2003 12:19:58 +0000 (UTC), "Fletcher Arnold"
<fl****@home.co m> ha scritto: "alessia" <al************ *@yahoo.it> wrote in message news:k2******* *************** **********@4ax. com... Il Sat, 11 Oct 2003 08:48:59 GMT, alessia <al************ *@yahoo.it> ha scritto:
>>Create a new query "qryExport" which is based on your first query but >>selects only the phone number. Then, if the button on your form isnamed >>'cmdExport' the code might be as shown below. Note that if you need a >>better way to select the export file path, then there is code for thistoo. >> >>Private Sub cmdExport_Click () >> >> On Error GoTo Err_Handler >> >> Dim strPath As String >> >> strPath = InputBox("Enter file path", , "C:\Shared\Test .txt") >> >> If Len(strPath) = 0 Then Exit Sub >> >> DoCmd.TransferT ext acExportDelim, , "qryExport" , strPath >> >> MsgBox "Done", vbInformation >> >>Exit_Handle r: >> Exit Sub >> >>Err_Handler : >> MsgBox Err.Description , vbExclamation, "Error No: " & Err.Number >> Resume Exit_Handler >> >>End Sub >>
OK, work! great! thanks Fletcher!
however when I open the created text file the telephone numbers come me this way
"33323214154163 85" "51564684815654 84"
how do I do for eliminating the " "??
I would like only the telephone number in this way
1515645166544 1454468468154
have a good day! There are a number of ways to do this. Perhaps the easiest is:
1. Select qryExport in the database window. 2. From the menu at the top choose File>Export 3. Select filename and type = text then press Export 4. On this screen you can press "Advanced" 5. Set up your options here - especially change text qualifier from " to none 6. Choose Save as ..."QryExport Export Specification" 7. Finish export
You can now change the code from: DoCmd.Transfer Text acExportDelim, , "qryExport" , strPath to: DoCmd.Transfer Text acExportDelim, "QryExport Export Specification", "qryExport" , strPath
If this is too difficult I could write some code to do this for you.
Fletcher
thanks Fletcher! very much!
have a nice day!
Alessia.
Il Sat, 11 Oct 2003 22:50:16 GMT, alessia <al************ *@yahoo.it>
ha scritto: If this is too difficult I could write some code to do this for you.
I have tried what you have suggested me you, Fletcher, but I would
prefer to serve everything as code... I would not like to disturb too
much, and if you have of the of leisure time to write the code, I
would be thankful of it... if it doesn't find you possible...don' t
worry you...I thank you... you have been kind indeed.
[i'm sorry my bad english...I hope is understood ]
alessia
"alessia" <al************ *@yahoo.it> wrote in message
news:ti******** *************** *********@4ax.c om... Il Sat, 11 Oct 2003 22:50:16 GMT, alessia <al************ *@yahoo.it> ha scritto:
If this is too difficult I could write some code to do this for you.
I have tried what you have suggested me you, Fletcher, but I would prefer to serve everything as code... I would not like to disturb too much, and if you have of the of leisure time to write the code, I would be thankful of it... if it doesn't find you possible...don' t worry you...I thank you... you have been kind indeed. [i'm sorry my bad english...I hope is understood ]
alessia
Hi Alessia
I am glad that you got the code to work. Don't worry about your English -
its fine, and very polite!
The following code is one possible version. It assumes your query is
"qryExport" which contains the field "Tel" - if not change the lines:
Set rst = dbs.OpenRecords et("qryExport" ...
and
Print #intFile, Nz(rst!Tel, "")
When you paste the new code in, make sure you compile the code -
Debug>Compile. If it does not compile, check Tools>Reference s and make sure
the box Microsoft DAO 3.6 Object Library is checked.
Good Luck
Fletcher
Private Sub cmdExport_Click ()
On Error GoTo Err_Handler
Dim strPath As String
Dim intFile As Integer
Dim strLine As String
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
strPath = InputBox("Enter file path", _
"Export", _
"C:\Shared\Test .txt")
If Len(strPath) = 0 Then Exit Sub
If Len(Dir(strPath )) > 0 Then
If MsgBox("This file already exists" & vbCrLf & _
"Would you like to overwrite it?", _
vbExclamation Or vbYesNoCancel, _
"Export") <> vbYes Then Exit Sub
End If
intFile = FreeFile
Open strPath For Output As #intFile
Set dbs = CurrentDb
Set rst = dbs.OpenRecords et("qryExport" , dbOpenForwardOn ly)
While Not rst.EOF
Print #intFile, Nz(rst!Tel, "")
rst.MoveNext
Wend
MsgBox "Export routine complete", _
vbInformation, "Export"
Exit_Handler:
On Error Resume Next
If Not rst Is Nothing Then
rst.Close
Set rst = Nothing
End If
If Not dbs Is Nothing Then
Set dbs = Nothing
End If
Close #intFile
Exit Sub
Err_Handler:
MsgBox Err.Description , vbExclamation, "Error No: " & Err.Number
Resume Exit_Handler
End Sub
Il Sun, 12 Oct 2003 20:15:58 +0000 (UTC), "Fletcher Arnold"
<fl****@home.co m> ha scritto: Hi Alessia I am glad that you got the code to work. Don't worry about your English - its fine, and very polite! The following code is one possible version. It assumes your query is "qryExport" which contains the field "Tel" - if not change the lines: Set rst = dbs.OpenRecords et("qryExport" ... and Print #intFile, Nz(rst!Tel, "")
When you paste the new code in, make sure you compile the code - Debug>Compil e. If it does not compile, check Tools>Reference s and make sure the box Microsoft DAO 3.6 Object Library is checked.
Good Luck
Fletcher
Private Sub cmdExport_Click ()
On Error GoTo Err_Handler
Dim strPath As String Dim intFile As Integer Dim strLine As String Dim dbs As DAO.Database Dim rst As DAO.Recordset
strPath = InputBox("Enter file path", _ "Export", _ "C:\Shared\Test .txt")
If Len(strPath) = 0 Then Exit Sub
If Len(Dir(strPath )) > 0 Then If MsgBox("This file already exists" & vbCrLf & _ "Would you like to overwrite it?", _ vbExclamation Or vbYesNoCancel, _ "Export") <> vbYes Then Exit Sub End If
intFile = FreeFile
Open strPath For Output As #intFile
Set dbs = CurrentDb
Set rst = dbs.OpenRecords et("qryExport" , dbOpenForwardOn ly)
While Not rst.EOF Print #intFile, Nz(rst!Tel, "") rst.MoveNext Wend
MsgBox "Export routine complete", _ vbInformation, "Export"
Exit_Handler :
On Error Resume Next
If Not rst Is Nothing Then rst.Close Set rst = Nothing End If
If Not dbs Is Nothing Then Set dbs = Nothing End If
Close #intFile
Exit Sub
Err_Handler: MsgBox Err.Description , vbExclamation, "Error No: " & Err.Number Resume Exit_Handler
End Sub
Ciao Super - Fletcher
I mind giving you so much trouble, I have copied the code that you
have given me, I have modified the interested lines, I have compiled
the program...I press the button, I insert the path and the name of
the file, and this error signals me...
Error No: 3061
non enough parameters. 3
[I hope both corrected the translation]
the file test.txt has been created... but it is empty..
I have modified only these lines
Set rst = dbs.OpenRecords et("query_fuori orario_cell",
dbOpenForwardOn ly)
and
Print #intFile, Nz(rst!cell, "")
query_fuori_ora rio : it's my export query
cell : it's a field of query_fuori_ora rio
according to you, as can I resolve this error??
I don't so finally disturb still you...
thx, Fletcher....
where r u from Fletcher?
i live in venice...
have a nice day!
"alessia" <al************ *@yahoo.it> wrote in message
news:0i******** *************** *********@4ax.c om... Il Sun, 12 Oct 2003 20:15:58 +0000 (UTC), "Fletcher Arnold" <fl****@home.co m> ha scritto:
Hi Alessia I am glad that you got the code to work. Don't worry about your
English -its fine, and very polite! The following code is one possible version. It assumes your query is "qryExport" which contains the field "Tel" - if not change the lines: Set rst = dbs.OpenRecords et("qryExport" ... and Print #intFile, Nz(rst!Tel, "")
When you paste the new code in, make sure you compile the code - Debug>Compil e. If it does not compile, check Tools>Reference s and make
surethe box Microsoft DAO 3.6 Object Library is checked.
Good Luck
Fletcher
Private Sub cmdExport_Click ()
On Error GoTo Err_Handler
Dim strPath As String Dim intFile As Integer Dim strLine As String Dim dbs As DAO.Database Dim rst As DAO.Recordset
strPath = InputBox("Enter file path", _ "Export", _ "C:\Shared\Test .txt")
If Len(strPath) = 0 Then Exit Sub
If Len(Dir(strPath )) > 0 Then If MsgBox("This file already exists" & vbCrLf & _ "Would you like to overwrite it?", _ vbExclamation Or vbYesNoCancel, _ "Export") <> vbYes Then Exit Sub End If
intFile = FreeFile
Open strPath For Output As #intFile
Set dbs = CurrentDb
Set rst = dbs.OpenRecords et("qryExport" , dbOpenForwardOn ly)
While Not rst.EOF Print #intFile, Nz(rst!Tel, "") rst.MoveNext Wend
MsgBox "Export routine complete", _ vbInformation, "Export"
Exit_Handler :
On Error Resume Next
If Not rst Is Nothing Then rst.Close Set rst = Nothing End If
If Not dbs Is Nothing Then Set dbs = Nothing End If
Close #intFile
Exit Sub
Err_Handler: MsgBox Err.Description , vbExclamation, "Error No: " & Err.Number Resume Exit_Handler
End Sub
Ciao Super - Fletcher I mind giving you so much trouble, I have copied the code that you have given me, I have modified the interested lines, I have compiled the program...I press the button, I insert the path and the name of the file, and this error signals me...
Error No: 3061 non enough parameters. 3 [I hope both corrected the translation]
the file test.txt has been created... but it is empty..
I have modified only these lines
Set rst = dbs.OpenRecords et("query_fuori orario_cell", dbOpenForwardOn ly)
and
Print #intFile, Nz(rst!cell, "")
query_fuori_ora rio : it's my export query cell : it's a field of query_fuori_ora rio
according to you, as can I resolve this error??
I don't so finally disturb still you...
thx, Fletcher....
where r u from Fletcher?
i live in venice...
have a nice day!
Error 3061 is caused by the query. I don't know what the SQL for
"query_fuoriora rio_cell" looks like, but if you had:
SELECT TelNumber
FROM tblNumbers
WHERE SomeDate=[Forms]![frm1].[txtSomeDate]
Then the query would produce this error. It cannot work out this bit
[Forms]![frm1].[txtSomeDate].
The solution to this is to build up the sql string separately - but this can
be quite complicated. If you would like me to have a look at the database
for you then just create a copy, delete any private data and e-mail it to
me. (I''ve copied this message to your e-mail) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Roy Riddex |
last post by:
I have a text file which holds data for 30 cars in the following way:
CarRegistration CarType CarClass Available
I'm trying to display the full contents of this text file in a list box so
the user can see the total car fleet, my problem is that I want everything
to line up. So far what I'm getting is something like:
R296RKV Ford Mondeo Large On Hire
TUVWXYZ ...
|
by: nunYa |
last post by:
I am trying to use the DoCmd.TransferText method to export an access table
to
a Tab Delimited Text File. I have put the code behind the onclick event of
a button
and keep getting the error "Run-time error '32027': Cannot update. Database
or object is read-only"
Code I using is:
Private Sub ExportButton_Click()
|
by: Marcelo |
last post by:
Hi,
I have to do the following, and would like you suggestions
on how I could achieve it the best way:
I have a text file in the following format:
12345 54321 98765 56789
(3 spaces between numbers)
|
by: Hexman |
last post by:
Code below ----
I'm trying to save some specific web pages to disk as text files. I searched the Internet and found a basic example which I changed to fit my needs.
I tested it out first on a single URL and it worked fine. Now when I incorporate an array of URL's, it fails to work. The first "responseFromServer"
properly retrieves and displays "http://finance.yahoo.com" (or any other valid URL for the first webrequest.create), but when I...
|
by: ETOPSA346 |
last post by:
Hello,
I am trying to write a program that will analyse a text file and do the following:
1. Count the number of characters.
2. Count the number of spaces.
3. Count the number of words.
4. Count the number of sentences.
5. Count the number of lines.
6. Ensure the 1st non-blank character in a sentence is capitalized. (I think this is done using a C function?)
| |
by: garth.waring |
last post by:
Hi all
I have seen the In Clause used to remotely query a text file done but
cannot find the right syntax
The example below is for an excel file :
SELECT *
FROM
IN 'C:\Reports\1620-1630_extract.xls ';
|
by: tariq103 |
last post by:
I am having trouble with a normally simple function, I am trying to read a text file and output what is in the file:
#include <iostream>
#include <cmath>
#include <iomanip>
#include <fstream> // To access a disk file (both input and output)
#include <string> // To use a sequence of characters
#include "Header.h"
using namespace std;
|
by: grumpydadtl |
last post by:
I am exporting a text file from Access that will be fed into a mainframe application (third party - not something I manage). The file contains a header record, body - which is the variable number of records to be imported into the mainframe, and a trailer record.
Upon export, Access automatically places a hard return after the trailer record - creating a new line after the trailer - albeit with no data on that line.
How can I create the...
|
by: CD Tom |
last post by:
This is driving me nuts!!! I have a table that one of the columns is set as Double, Fixed, 3 digits. I try and export this to a .txt file for a backup using the docmd.transfertext command but when I look at the file I only have 2 digits. What am I doing wrong and how can I get this to export 3 digits.
Hopefully come one can give me an answer.
Thanks for all your help.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |