By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,262 Members | 2,664 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,262 IT Pros & Developers. It's quick & easy.

Export a txt file generate file name

P: n/a
I have a database with 50000 records containing phone numbers, I need to
export the phone numbers sorted by area code, and create/save to .txt using
the area code as the phone number. I create the export template using the
wizard but cant get the code to run off my form button. Thanks any help is
greatly appreciated.

Feb 8 '07 #1
Share this Question
Share on Google+
6 Replies


P: n/a
On Feb 8, 12:07 pm, "Vic4338" <u31603@uwewrote:
I have a database with 50000 records containing phone numbers, I need to
export the phone numbers sorted by area code, and create/save to .txt using
the area code as the phone number. I create the export template using the
wizard but cant get the code to run off my form button. Thanks any help is
greatly appreciated.

You haven't yet stated what code is not working so nobody would know
why.
Have you looked at the various methods of DoCmd or the various macros?
TransferDatabase, TransferText, TransferSpreadSheet all come to mind.
Perhaps looking at some of these in the help files would be a good
start.

Feb 12 '07 #2

P: n/a
Sorry I was flustered. I am running access 2003, the first issue I’m having
is I macro wizard is not working, states running in Sandbox mode, I have
download the update for Jet 4.0 and it tells me all ready installed however,
its not listed in the Ref library. I have created the qry export – ran wizard
saved export template. Used the following VBA code:

Private Sub Command0_Click()

Dim rst As DAO.Recordset
Dim strSql As String

Set rst = CurrentDb.OpenRecordset("select distinct left(HomePhone,3) as
AreaCodeID from OUTPUT")

Do While rst.EOF = False
strDql = "select * into [text;fmt=dellimited;HDR=Yes;Database=C:]." & _
rst!areacodeid & "_actuals.txt" & _
"from OUTPUT where left(HomePhone,3)= " ' & rst!areacodeid & """
CurrentDb.Execute strSql
rst MoveNext
Loop
rst.Close

End Sub

Compile error: Invalid use of property: at rst MoveNext

Thanks

__________________________________________________ ____

storrboy wrote:
>I have a database with 50000 records containing phone numbers, I need to
export the phone numbers sorted by area code, and create/save to .txt using
the area code as the phone number. I create the export template using the
wizard but cant get the code to run off my form button. Thanks any help is
greatly appreciated.

You haven't yet stated what code is not working so nobody would know
why.
Have you looked at the various methods of DoCmd or the various macros?
TransferDatabase, TransferText, TransferSpreadSheet all come to mind.
Perhaps looking at some of these in the help files would be a good
start.
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200702/1

Feb 12 '07 #3

P: n/a
Hi,
Compile error: Invalid use of property: at rst MoveNext
A dot is missing:
rst.MoveNext

Regards
Jens
Feb 12 '07 #4

P: n/a
Didn't catch that, thanks ---

Error is now at CurrentDb.Execute strSql ????

This should work

____________________________--

Jens Schilling wrote:
>Hi,
>Compile error: Invalid use of property: at rst MoveNext

A dot is missing:
rst.MoveNext

Regards
Jens
--
Message posted via http://www.accessmonster.com

Feb 12 '07 #5

P: n/a
On Feb 12, 1:45 pm, "Vic4338 via AccessMonster.com" <u31603@uwe>
wrote:
Didn't catch that, thanks ---

Error is now at CurrentDb.Execute strSql ????
....

"from OUTPUT where left(HomePhone,3)= " ' & rst!areacodeid & """
^single-
quote ^double-quote

One or the other needs to be changed so quotes are balanced...

cheers
Chris

Feb 12 '07 #6

P: n/a
On Feb 12, 2:37 pm, "ChrisHulan" <chris.hu...@gmail.comwrote:
On Feb 12, 1:45 pm, "Vic4338 via AccessMonster.com" <u31603@uwe>
wrote:Didn't catch that, thanks ---
Error is now at CurrentDb.Execute strSql ????

...

"from OUTPUT where left(HomePhone,3)= " ' & rst!areacodeid & """
^single-
quote ^double-quote

One or the other needs to be changed so quotes are balanced...

cheers
Chris
Damn, formatting really screwed that up

Just to be clear, you opening single-quote with no matching close
single-quote
and you have a close double-quote with no matching opening double-
quote
One or the other needs changing so the quotes are balanced

Cheers

Feb 12 '07 #7

This discussion thread is closed

Replies have been disabled for this discussion.