SunQuest
           Database Management
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesDatabase Management

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old July 15th, 2003, 07:48 AM
jharber15 jharber15 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 41 jharber15 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Access/VBA noob question

Hi guys,

I was wondering how you export a form out of access into a .txt file. if anyone has a clue let me know. I know that access supplies an automatic feature, but I'd like to go a bit further with this. Thanks,

Jason

Reply With Quote
  #2  
Old July 15th, 2003, 11:25 PM
victorpendleton victorpendleton is offline
Contributing User
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Jan 2003
Location: No es importante
Posts: 2,065 victorpendleton User rank is Private First Class (20 - 50 Reputation Level)victorpendleton User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 6 h 31 m 56 sec
Reputation Power: 8
Have you tried using the export functionality in MS Access.
__________________
El éxito consiste en una serie de pequeñas victorias día a día

MySQL, MS SQL, MS ACCESS, Oracle Database Manager - http://victorpendleton.net/products/psdviewer.html

Reply With Quote
  #3  
Old July 16th, 2003, 06:41 AM
jharber15 jharber15 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 41 jharber15 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Yeah, you can export a form into text, but I need to take the table data and put some special characters inbetween entries. That's the reason that I need to do the text export manually. Access allows you to do several exports, but none fit what I need. Thanks for taking the time to read. Hopefully, I'll get some ideas.


Jason

Reply With Quote
  #4  
Old July 16th, 2003, 08:14 AM
victorpendleton victorpendleton is offline
Contributing User
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Jan 2003
Location: No es importante
Posts: 2,065 victorpendleton User rank is Private First Class (20 - 50 Reputation Level)victorpendleton User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 6 h 31 m 56 sec
Reputation Power: 8
Do you have access to any third party tools such as Data Junction or the MS DTS tool? These tools will allow you to define transformations. You can also write a query with the data in the exported format and save the query results.

Reply With Quote
  #5  
Old July 16th, 2003, 11:58 AM
jharber15 jharber15 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 41 jharber15 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
i don't have access to those. All i have is visual studio and access. I doubt that I can get my hands on any other applications that would be of use.

Reply With Quote
  #6  
Old July 16th, 2003, 10:36 PM
victorpendleton victorpendleton is offline
Contributing User
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Jan 2003
Location: No es importante
Posts: 2,065 victorpendleton User rank is Private First Class (20 - 50 Reputation Level)victorpendleton User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 6 h 31 m 56 sec
Reputation Power: 8
You could try writing a query to generate the output and export the query.

Reply With Quote
  #7  
Old July 21st, 2003, 07:14 AM
jharber15 jharber15 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 41 jharber15 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Ok, I have the query that I would like to run. I'm now having trouble finding documentation on how to code the query into visual basic. Any help would be appreciated! Thanks.

Reply With Quote
  #8  
Old July 21st, 2003, 08:06 AM
victorpendleton victorpendleton is offline
Contributing User
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Jan 2003
Location: No es importante
Posts: 2,065 victorpendleton User rank is Private First Class (20 - 50 Reputation Level)victorpendleton User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 6 h 31 m 56 sec
Reputation Power: 8
If you are familiar with Database Programming with Visual Basic this may help you.
PHP Code:
Public Function test(sqltorun As String)
On Error GoTo Err_test
    Dim myRS 
As New ADODB.Recordset

    Set myRS 
= New ADODB.Recordset
    myRS
.ActiveConnection Driver={MySQL ODBC 3.51 Driver};server=;DB=;UID=;PWD=

    
myRS.Open sqltorun
    
If myRS.BOF And myRS.EOF Then
        MsgBox 
"Tell the user something"vbCritical"Error"
    
Else
    '
Do someaction
    End If

Exit_test:
    Exit function

Err_test:
    MsgBox "Error occurred.", vbOKOnly, "Error"
    Resume Exit_test:
End Function 

Reply With Quote
  #9  
Old July 21st, 2003, 09:42 AM
jharber15 jharber15 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 41 jharber15 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
I'm not too familiar with VB. I'm just starting, but have to do all of this in my project. Any clarification would be greatly appreciated!

Reply With Quote
  #10  
Old July 21st, 2003, 09:58 PM
victorpendleton victorpendleton is offline
Contributing User
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Jan 2003
Location: No es importante
Posts: 2,065 victorpendleton User rank is Private First Class (20 - 50 Reputation Level)victorpendleton User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 6 h 31 m 56 sec
Reputation Power: 8
Try the code I posted above subsituting the MySQL code for MS Access.

Reply With Quote
  #11  
Old July 23rd, 2003, 03:24 PM
jharber15 jharber15 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 41 jharber15 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
I could not get that code to work

In Access and VB I get an error from the { bracket in the mySQL code (or MS Access).

I'm stumped :-(

Reply With Quote
  #12  
Old July 24th, 2003, 09:45 PM
Doug G Doug G is offline
Grumpier Old Moderator
Dev Shed God 12th Plane (10500 - 10999 posts)
 
Join Date: Jun 2003
Posts: 10,703 Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level) 
Time spent in forums: 4 Weeks 1 Day 21 h 25 m 29 sec
Reputation Power: 688
I would probably use VBA code from a form button to export to a file using the filesystem object. Add a reference to the Microsoft Scripting runtime. In the button click event, copy the forms recordsetclone to a temporary recordset. Create the filesystem object and set up your output file, then iterate through the recordset and create each text line from the data in the recordset and write each line out to the destination file.

Reply With Quote
  #13  
Old July 25th, 2003, 12:30 PM
victorpendleton victorpendleton is offline
Contributing User
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Jan 2003
Location: No es importante
Posts: 2,065 victorpendleton User rank is Private First Class (20 - 50 Reputation Level)victorpendleton User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 6 h 31 m 56 sec
Reputation Power: 8
Can you post how you are making your VB to MS Access data connection?

Reply With Quote
  #14  
Old July 28th, 2003, 07:37 AM
jharber15 jharber15 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 41 jharber15 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
my database connection

Dim sDatabase As String
Dim daoDB As Database
Dim daoRS As Recordset


Private Sub cmdOpen_Click()
Dim fField As Field

sDatabase = "C;\file.mdb"
Set daoDB = OpenDatabase(sDatabase)
Set daoRS = daoDB.OpenRecordset("SELECT * FROM Transactions")



Sorry it took me awhile to get back on the boards. Let me know what you think is the problem

Reply With Quote
  #15  
Old July 28th, 2003, 07:57 AM
victorpendleton victorpendleton is offline
Contributing User
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Jan 2003
Location: No es importante
Posts: 2,065 victorpendleton User rank is Private First Class (20 - 50 Reputation Level)victorpendleton User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 6 h 31 m 56 sec
Reputation Power: 8
Was the C;\file.mdb a mistype? What is the OpenDatabase function doing? This seems to be where the work is really ocurring.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesDatabase Management > Access/VBA noob question


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump