|
-
Nov 8th, 2005, 07:43 AM
#1
-
Nov 8th, 2005, 07:57 AM
#2
Hyperactive Member
-
Nov 8th, 2005, 11:58 AM
#3
Thread Starter
New Member
Re: splitting a column in alphabetic folders?
Hello!!
Thank you for trying to help me, nagasrikanth!
The file you attached contains only a database. Did you forget to add something?
G.
-
Nov 8th, 2005, 11:22 PM
#4
-
Nov 9th, 2005, 03:16 AM
#5
Thread Starter
New Member
Re: splitting a column in alphabetic folders?
I can not read the database direct from where i am.
Could you please show me the code direct here in the forum instead, or send it to me as a message?
Many thanks in advance for your time,
G.
-
Nov 9th, 2005, 08:56 AM
#6
Hyperactive Member
Re: splitting a column in alphabetic folders?
okay...then...here is the code...
first place u r data in a table named "table1" and then run this code by placing it in a form
VB Code:
Option Compare Database
Option Explicit
Private Declare Function CreateDirectory Lib "kernel32" Alias "CreateDirectoryA" (ByVal lpPathName As String, lpSecurityAttributes As SECURITY_ATTRIBUTES) As Long
Private Type SECURITY_ATTRIBUTES
nLength As Long
lpSecurityDescriptor As Long
bInheritHandle As Long
End Type
Private Sub Command0_Click()
Dim Security As SECURITY_ATTRIBUTES
Dim prevletter
Dim fstletter
Dim lngHandle As Long
Dim rst As Recordset
Dim fs As New FileSystemObject
Dim flname
Dim fl
Set rst = CurrentDb.OpenRecordset("table1")
If Not rst.RecordCount = 0 Then
rst.MoveFirst
While Not rst.EOF
fstletter = Left(rst(0), 1)
If Not prevletter = fstletter Then
CreateDirectory "C:\" & fstletter, Security
prevletter = fstletter
End If
flname = fs.BuildPath("c:\" & fstletter, rst(0) & ".txt")
Set fl = fs.CreateTextFile(flname, True)
rst.MoveNext
Wend
End If
End Sub
The Difference between a Successful person and others is not a Lack of Knowledge,
But rather a Lack of WILL 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|