PC Review


Reply
Thread Tools Rate Thread

CreateField Method or Data Member Not Found

 
 
New Member
Join Date: May 2011
Posts: 1
 
      2nd May 2011
I am getting a Compiler Error "Method or Data Member not found" when trying to create a field with my macro. I am using Excel as my interface but using Access (OLE). I have referenced the appropriate DAO and Access Libraries and have assigned my definitions to DAO, a common fix for the problem I am having. I know that it is using access properly because when trying to merely populate an already created table the macro works. It fails to work when I try to create a table, here are the necessary parts of my code (at least I believe them to be the necessary parts):

Dim db As DAO.Database
Dim rs1 As Recordset, rs2 As Recordset
Dim fldnmbr As Long
Dim Accessapp As Object
Dim Atlas As String
Dim tbl As DAO.TableDefs
Dim fld As DAO.Field

Atlas = ActiveWorkbook.Path & "\Consultation Atlas.mdb"
Set Accessapp = GetObject(Atlas, "Access.Database")
Set db = Accessapp.CurrentDb
Set tbl = db.CreateTableDef("Germany Results")
Set rs1 = db.OpenRecordset("Germany")
rs1.MoveFirst
tbl.Fields.Append tbl.CreateField(rs1.Fields(0).Name, dbText)
tbl.Fields.Append tbl.CreateField(rs1.Fields(1).Name, dbText)
tbl.Fields.Append tbl.CreateField(rs1.Fields(2).Name, dbText)

db.TableDefs.Append tbl
db.TableDefs.Refresh
Accessapp.Quit
Set Accessapp = Nothing


anybody have any ideas where I'm going wrong with this? I'm not a developer just a technical user. i used the code as described in the access vba editor help section, and have tried other iterations found online but none work. if somebody could help me out I would owe you my life! Thanks!
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Method or data member not found Martin Microsoft Access VBA Modules 5 29th Dec 2009 12:47 PM
Method of Data Member Not found Gaetanm via AccessMonster.com Microsoft Access Forms 6 14th Nov 2006 04:24 PM
Method or Data Member not found? =?Utf-8?B?U2hhcm9u?= Microsoft Access Form Coding 7 21st Oct 2005 04:27 PM
Method or data member not found with Move method Kate Microsoft Access Form Coding 2 1st Dec 2004 02:58 PM
Method or Data member not found LisaB Microsoft Access VBA Modules 1 14th Oct 2004 03:48 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:43 AM.