erin_0502 This user has been deleted
|
nak tanye camane nak transfer taex pada text file tapi xnak semua column.....nak pilih column yang penting je....
ni coding erin
Option Compare Database
Option Explicit
'Public Sub Main()
'ExportDatabaseObjects()
'End Sub
'Public Sub ExportDatabaseObjects()
Public Sub Main()
On Error GoTo Err_ExportDatabaseObjects
Dim db As Database
'Dim db As DAO.Database
Dim td As TableDef
Dim i As Integer
Dim strFilename As String
Dim sExportLocation As String
Dim Expression As String
Dim returnValue() As String
Set db = CurrentDb()
sExportLocation = "N:\- Guest -\guestbcs\usrPrivate\irni\irni\access\"
For Each td In db.TableDefs 'Tables
If Left(td.Name, 4) <> "MSys" Then
strFilename = sExportLocation & td.Name & ".txt"
Debug.Print strFilename
DoCmd.TransferText acExportDelim, , td.Name, strFilename, False
End If
Next td
For i = 0 To db.QueryDefs.Count - 1
Application.SaveAsText acQuery, db.QueryDefs(i).Name, sExportLocation & db.QueryDefs(i).Name & ".txt"
Next i
Set db = Nothing
MsgBox "All table been exported as a text file to " & sExportLocation, vbInformation
Exit_ExportDatabaseObjects:
Exit Sub
Err_ExportDatabaseObjects:
MsgBox Err.Number & " - " & Err.Description
Resume Exit_ExportDatabaseObjects
End Sub
tau x camane nak tambah.... |
|
|
|
|
|
|
|
ini vb ker??? aduh dah lama tinggal vb.... u pakai table jenis apa? msGrid ker? yang ada column2 kat interface u tuh.. |
|
|
|
|
|
|
|
Reply #1 erin_0502's post
VBA for Microsoft Access nih.
Nape tak buat je query baru, select column yang dikehendaki, then expore query baru tu ke text file? |
|
|
|
|
|
|
|
not maksud aku.. table kat screen tuh.. mean msflexgrid ker.. cara mudah .. u design msflexgrid dulu, ambek kat component/control.. if u tau guna control2 tuh rasa takde masalah.. cara shahnaz tuh btul.. yg penting u tau how to retrieve data by data in column tuh dulu.. then baru u insert in text.. |
|
|
|
|
|
|
|
i nk tunjuk coding pun takleh.. takde installer vb, malas nk dunload .. lagipun contoh2 project i guna vb pun ada kat kg.. aduh.. ruginya xdapat bkongsi.. takpe i try cari.. saba eks..
cam kes ini utk datagrid..
Private Sub DGrid DblClick()
With DGrid
yourVariable = .Columns(0).Text. " , ".Columns((1).Text
End With
Dim sFileText as String
Dim iFileNo as Integer
iFileNo = FreeFile
'open the file for writing
Open "C:\Test.txt" For Output As #iFileNo
'write some example text to the file
Print #iFileNo, yourVarible
Close #iFileNo
End Sub
pastu your letak variable tuh..
camtuhla serba sedikit.. ko ubah la ikut kesesuaian
[ Last edited by liverpoolfctv at 22-8-2007 02:00 PM ] |
|
|
|
|
|
|
| |
|