SOLVED : [AccessD] URGENT: Accessing DBF files from VBA with more than 255 Fields.

Erwin Craps Erwin.Craps at ithelps.be
Wed Jun 18 07:45:44 CDT 2003


Thank you
 
 
-----Oorspronkelijk bericht-----
Van: Arthur Fuller [mailto:artful at rogers.com] 
Verzonden: woensdag 18 juni 2003 12:58
Aan: accessd at databaseadvisors.com
Onderwerp: RE: [AccessD] URGENT: Accessing DBF files from VBA with more than
255 Fields.


This little function won't do everything you want, but it should help
considerably. A little cutting and pasting and you're there:
 
<code>
Public Function FieldList(strSource As String, Optional intType As Integer,
_
    Optional bIncludePK As Boolean) As String
'Returns a comma-delimited list of the fieldnames from a table
'Not including the first field
'On the assumption that this field is the Primary Key
'TODO: refine this assumption before publication, make it test against PK
'
    Dim rst As ADODB.Recordset
    Dim fld As ADODB.Field
    Dim i As Integer
    'Dim cnn As Connection
    Dim strList As String
    
    'Set cnn = CurrentProject.Connection
    Set rst = New ADODB.Recordset
    
    rst.Open strSource, CurrentProject.Connection
    For i = 0 To rst.Fields.Count - 1           'skip the first field (PK
usually)
        Set fld = rst.Fields(i)
        With fld
            If Left$(.Name, 2) <> "s_" And Left$(.Name, 4) <> "MSys" Then
                Select Case intType
                    Case 0
                        strList = strList & .Name & ", "
                    Case 1
                        strList = strList & "[" & strSource & "].[" & .Name
& "], "
                End Select
            End If
        End With
    Next
    FieldList = Left(strList, Len(strList) - 2)     'drop the final ", "
    rst.Close
    Set rst = Nothing
    Set fld = Nothing
End Function
</code>
 
 
 

"Those who would sacrifice liberty for security deserve neither."
-- Benjamin Franklin 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Erwin Craps
Sent: June 18, 2003 6:24 AM
To: 'accessd at databaseadvisors.com'
Subject: [AccessD] URGENT: Accessing DBF files from VBA with more than 255
Fields.
Importance: High


Hi
 
I have linked DBF files into my AXP, importing does not work, with more than
255 fields.
I need to cross check two identical tables, for typo errors.
 
But I can acces these tables from VBA (tried DAO and ADODB recordset) with a
SELECT * statement due to these +255 fields problem.
 
I could use "SELECT Field1, Field2, Field3" etc but you understand this is
some typ work.
Is there an SQL statement that I could use?
Something that allows me to select  fields 1 to 250 and afterwards fields
1,2,3,4,5, field 251 to last field.
 
Or do I really need to typ in every fields name...
 
Or can numericly refer to a field instead of using field names in my SQL
string?
 
Thanks
 
 

 

Erwin Craps

Zaakvoerder 

www.ithelps.be/jonathan <http://www.ithelps.be/jonathan> 

 


This E-mail is confidential, may be legally privileged, and is for the
intended recipient only. Access, disclosure, copying, distribution, or
reliance on any of it by anyone else is prohibited and may be a criminal
offence. Please delete if obtained in error and E-mail confirmation to the
sender.

IT Helps - I.T. Help Center  ***  Box Office Belgium & Luxembourg

www.ithelps.be <http://www.ithelps.be/>   *  www.boxoffice.be
<http://www.boxoffice.be/>   *   <http://www.stadleuven.be/>
www.stadleuven.be

IT Helps bvba* ** Mercatorpad 3 **  3000 Leuven

IT Helps  *  Phone: +32 16 296 404  *  Fax: +32 16 296 405 E-mail:
Info at ithelps.be <mailto:Info at ithelps.be>  

Box Office **  Fax: +32 16 296 406 **  Box Office E-mail:
<mailto:figures at boxoffice.be> Staff at boxoffice.be

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://databaseadvisors.com/pipermail/accessd/attachments/20030618/93daac00/attachment.html>


More information about the AccessD mailing list