ich bin mit VBA noch nicht sehr lange vertraut, und habe nun eine rießengroßes Problem:
Ich muß von einer Access-Tabelle Daten via eines VBA-Scripts in SQl_Plus übertragen.
Habe wie folgt begonnen:
Sub sales_extract()
Dim db As Database
Dim rs As Recordset
Dim SQL, str As String
Dim strFileName, tmp_number As String
Dim list As Collection
Dim i As Integer
Set db = DBEngine.OpenDatabase("U:\student\MADE\irgendwas.MDB", False, False)
SQL = "Select t.time_key, t.product_key, " & _
"t.promotion_key, " & _
"t.store_key, " & _
"Format(t.dollar_sales, ""General Number"") as dollar_sales, " & _
"t.unit_sales, " & _
"t.dollar_cost, " & _
"t.customer_count " & _
"FROM Sales_fact t;"
'SQL = "Select * from sales;"
Debug.Print SQL
Set rs = db.OpenRecordset(SQL, dbOpenSnapshot)
rs.MoveFirst
Set list = New Collection
Do While Not rs.EOF
str = "insert into sales (" & _
"time_key, product_key, promotion_key, " & _
"store_key, dollar_sales, " & _
"unit_sales, dollar_cost, " & _
"customer_count) values ("
str = str & rs!time_key & ","
str = str & rs!product_key & ","
str = str & rs!promotion_key & ","
str = str & rs!store_key & ","
str = str & rs!dollar_sales & ","
str = str & rs!unit_sales & ","
str = str & rs!dollar_cost & ","
str = str & rs!customer_count & ");"
list.Add (str)
rs.MoveNext
Loop
strFileName = "insert_salesfact.sql"
Open ThisWorkbook.Path & "\" & _
strFileName For Output Access Write As #2
For i = 1 To list.Count
Print #2, list(i)
Next i
Close #2
rs.Close
db.Close
End Sub
Das klappt alles wunderbar, nur das Problem ist, daß bei der Ausgabe in Notepad z.B die dollar_sales mit einem Komma verbunden sind. Ich will nun, daß diese Werte mit einem Punkt verbunden sind.
z.B 7.5 statt 7,5 !!!!!
Ansonsten erkennt SQL-Plus zuviele Werte und kann die Daten nicht importieren...
Vielen Dank für eure große Hilfe
:-)
SEbastian