将查询导出到文本文件[help!] [英] exporting query to text file [help!]

查看:60
本文介绍了将查询导出到文本文件[help!]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个可视化我的查询,根据

我插入的一些标准,姓名,姓氏,地址,电话

ok ..


现在,通过一个按钮,放在一个表格中,

我只需要从这个查询中导出一个文本中的现场电话

文件

文本文件的名称我想选择我...


文本文件示例:


345368998756

345894614542

168416616464

165445648250


他们必须在每一行都出现一个电话号码,而没有任何

;或者

,就像我上面所做的例子一样..

有人可以帮我吗?一些代码示例?

谢谢

alexia

我可以访问新手.....

[我很绝望]

解决方案

" alessia" <人************* @ yahoo.it>在消息中写道

新闻:gv ******************************** @ 4ax.com ...


我有一个可视化我的查询,根据我插入的一些标准,姓名,姓,地址,电话确定。 。

现在,通过一个按钮,定位在一个Form中,我只需要从这个查询中导出现场电话中的文本
文件名称文本文件我想选择我...

文本文件示例:

345368998756
345894614542
168416616464
165445648250 <他们将不得不在每一行都出现一个电话号码而没有任何
;或者
就像我上面所做的例子一样..
有人可以帮助我吗?一些代码示例?
感谢
alexia
我正在接触新手.....
[我很绝望]



创建一个新查询qryExport这是基于您的第一个查询,但

仅选择电话号码。然后,如果表单上的按钮被命名为

''cmdExport'',则代码可能如下所示。请注意,如果你需要一个更好的方法来选择导出文件路径,那么也有代码。


Private Sub cmdExport_Click()


错误GoTo Err_Handler


Dim strPath As String


strPath = InputBox(" Enter file path",," C:\ Shared \Test.txt")

如果Len(strPath)= 0则退出Sub


DoCmd.TransferText acExportDelim ,," qryExport",strPath


MsgBox" Done",vbInformation


Exit_Handler:

退出Sub


Err_Handler:

MsgBox Err.Description,vbExclamation,"错误号:" &安培; Err.Number

恢复Exit_Handler


结束子


Il Fri,10 2003年10月08:06:24 +0000(UTC),Fletcher Arnold

< fl **** @ home.com> ha scritto:

" alessia" <人************* @ yahoo.it>在消息中写道
新闻:gv ******************************** @ 4ax.com ..。< blockquote class =post_quotes>
我有一个可视化我的查询,根据我插入的一些标准,姓名,姓,地址,电话确定..

现在,通过一个按钮,定位在一个表格中,
我只需要从这个查询中导出现场电话的文本文件
文本文件的名称我我想选择我......

文本文件示例:

345368998756
345894614542
168416616464
165445648250
<他们必须在每一行都出现一个电话号码,而不是任何
;或者
就像我上面所做的例子一样..
有人可以帮助我吗?一些代码示例?
感谢
alexia
我正在接触新手.....
[我很绝望]


创建新查询qryExport这是基于您的第一个查询,但
只选择电话号码。然后,如果表单上的按钮名为
''cmdExport'',则代码可能如下所示。请注意,如果您需要更好的方法来选择导出文件路径,那么也有代码。

私有子cmdExport_Click()

错误GoTo Err_Handler

Dim strPath As String

strPath = InputBox(" Enter file path"," C:\Shared\Test.txt")

如果Len(strPath)= 0则退出Sub

DoCmd.TransferText acExportDelim ,," qryExport",strPath

MsgBox" Done", vb信息

Exit_Handler:
退出Sub

Err_Handler:
MsgBox Err.Description,vbExclamation,"错误号:" &安培; Err.Number
恢复Exit_Handler

结束子




谢谢!你是善良的..我马上尝试你给的代码

我...

借口我糟糕的英语...我是意大利语

美好的一天


Il Sat,2003年10月11日08:48:59 GMT,alessia< al ********* ****@yahoo.it>

ha scritto:

创建新查询 qryExport"这是基于您的第一个查询,但
只选择电话号码。然后,如果表单上的按钮名为
''cmdExport'',则代码可能如下所示。请注意,如果您需要更好的方法来选择导出文件路径,那么也有代码。

私有子cmdExport_Click()

错误GoTo Err_Handler

Dim strPath As String

strPath = InputBox(" Enter file path"," C:\Shared\Test.txt")

如果Len(strPath)= 0则退出Sub

DoCmd.TransferText acExportDelim ,," qryExport",strPath

MsgBox" Done", vb信息

Exit_Handler:
退出Sub

Err_Handler:
MsgBox Err.Description,vbExclamation,"错误号:" &安培; Err.Number
恢复Exit_Handler

End Sub




好​​的,工作!大!谢谢弗莱彻!


然而,当我打开创建的文本文件

时,电话号码就这样来了我


3332321415416385

" 5156468481565484"


如何消除b $ b ??


我只希望这样的电话号码


1515645166544

1454468468154


祝你有个美好的一天!


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]

解决方案

"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.TransferText 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.com> 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.TransferText 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.TransferText 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



OK, work! great! thanks Fletcher!

however when I open the created text file
the telephone numbers come me this way

"3332321415416385"
"5156468481565484"

how do I do for eliminating the " "??

I would like only the telephone number in this way

1515645166544
1454468468154

have a good day!


这篇关于将查询导出到文本文件[help!]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆