|
||||
| ||||
|
|||||||
| OOTP Mods - Database Tools Do you need to take a dump? SQL gurus welcome |
![]() |
|
|
Thread Tools |
|
|
#1 |
|
Major Leagues
Join Date: Jan 2002
Location: tucson, az
Posts: 344
|
How do you get the ms_access dump into Access ?
How do you get the ms_access dump into Access ? How do you run the scripts in Access ?
Thanks. |
|
|
|
|
|
#2 |
|
Minors (Triple A)
Join Date: Apr 2002
Location: Mauston, WI
Posts: 226
|
Good question. I'm wondering the same thing.
I have access to Access, and would rather go with that, than starting to learn a variation of SQL (if I don't have to).
__________________
Robert C Buss FOBL Mauston Mad Cows |
|
|
|
|
|
#3 |
|
All Star Reserve
Join Date: Apr 2004
Posts: 822
|
I'd imagine that Marc will be posting whatever tools have been submitted to the contest referenced in this thread in not too long of a time.
|
|
|
|
|
|
#4 | |
|
Administrator
Join Date: Jun 2002
Location: Hollern/Stade/Germany
Posts: 8,992
|
Quote:
ATTENTION!!!! No support for this script, and use at your own risk ![]() Code:
Sub import()
Dim fso As FileSystemObject
Dim fo As Folder
Dim f As File
Dim t As TextStream
Dim z As String
Dim i As Long
Dim db As Database
On Error GoTo err_sub
Set db = CurrentDb()
Set fso = New FileSystemObject
Set fo = fso.GetFolder("C:\ootp\data\saved_games\New Game.lg\import_export")
For Each f In fo.Files
If f.Name Like "*.access.sql" Then
Debug.Print
Debug.Print f.Name
DoEvents
Set t = f.OpenAsTextStream(1)
i = 0
Do While Not t.AtEndOfStream
i = i + 1
z = t.ReadLine
z = Trim$(z)
If z <> "" Then
db.Execute z, dbFailOnError
End If
Loop
t.Close
Set t = Nothing
End If
Next f
MsgBox "Done!"
exit_sub:
On Error Resume Next
db.Close
Exit Sub
err_sub:
Debug.Print
Debug.Print Err.Description
If z Like "DROP TABLE*" Then
Resume Next
Else
If MsgBox("" & f.Name & vbCrLf & t.Line & vbCrLf & z, vbOKCancel, "Error") = vbOK Then
Resume Next
Else
Resume exit_sub
End If
End If
End Sub
|
|
|
|
|
|
|
#5 |
|
Minors (Triple A)
Join Date: Apr 2002
Location: Mauston, WI
Posts: 226
|
Thanks, Andreas, I'll have to give that a try.
What I ended up doing, this time, was importing the .csv files one by one into Access.
__________________
Robert C Buss FOBL Mauston Mad Cows |
|
|
|
|
|
#6 |
|
Hall Of Famer
Join Date: Nov 2004
Location: In a house in Saint Cloud, Florida.
Posts: 7,085
|
It does not work in Access 2003
__________________
Like BLUES? Visit www.smokestacklightnin.com, you will LOVE it! New show every Monday!! New Blues HOF![/COLOR][/FONT]
|
|
|
|
|
|
#7 |
|
Minors (Triple A)
Join Date: Apr 2002
Location: Mauston, WI
Posts: 226
|
I'm using Access 2002 at home, which is a different version from what I have at work.
I went through File --> Get External Data --> Import Is that the part that Access 2003 won't let you do?
__________________
Robert C Buss FOBL Mauston Mad Cows |
|
|
|
|
|
#8 |
|
Hall Of Famer
Join Date: Nov 2004
Location: In a house in Saint Cloud, Florida.
Posts: 7,085
|
I have not tried the CSV, I know that should work, but was talking about his VB code in the above example.
__________________
Like BLUES? Visit www.smokestacklightnin.com, you will LOVE it! New show every Monday!! New Blues HOF![/COLOR][/FONT]
|
|
|
|
|
|
#9 | |
|
Hall Of Famer
Join Date: Mar 2002
Location: Tampa, FL USA
Posts: 4,503
|
Quote:
Post 51
__________________
When is good enough, good enough? |
|
|
|
|
|
|
#10 | |
|
Hall Of Famer
Join Date: Aug 2003
Posts: 4,925
|
Quote:
Fairly easy, I didn't care to go into anything deeper since I'm just doing this for fun, and trying to go deeper would result in the loss of the rest of my hair.
|
|
|
|
|
![]() |
| Bookmarks |
|
|