It seems to me that you skipped over the setting of the database
itself, i.e. the Set dbs = statement is missing. Therefore your VBA
code doesn't know what dbs is.

On Oct 1, 12:05 am, kuhrty <mark.ku...@gmail.com> wrote:
> I am trying to create a table in Access 2003 through VBA.  I keep
> getting an error 91 where the Object variable or With Block is not
> set.  If appears like I have all the right code to create this table
> but I can't get beyond the Set statement.
>
> Thanks in advance.
>
> Dim dbs As Database
> Dim tdf As TableDef
>
> Set tdf = dbs.CreateTableDef("tbl_OPRiskMK")
>     tdf.Fields.Append tdf.CreateField("Region", dbText)
>     tdf.Fields.Append tdf.CreateField("Sector", dbText)
>     tdf.Fields.Append tdf.CreateField("Business", dbText)
>     tdf.Fields.Append tdf.CreateField("EventCategory", dbText)
>     tdf.Fields.Append tdf.CreateField("Qtr_Yr", dbText)
>     tdf.Fields.Append tdf.CreateField("NetAmount_USD", dbDouble)
>     tdf.Fields.Append tdf.CreateField("EventRank", dbByte)
>     tdf.Fields.Append tdf.CreateField("BusinessRank", dbByte)
>     dbs.TableDefs.Append tdf

--~--~---------~--~----~------------~-------~--~----~
----------------------------------------------------------------------------------
Some important links for excel users:
1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at 
http://www.excelitems.com
2. Excel tutorials at http://www.excel-macros.blogspot.com
3. Learn VBA Macros at http://www.vbamacros.blogspot.com
4. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 

To post to this group, send email to excel-macros@googlegroups.com
If you find any spam message in the group, please send an email to:
Ayush Jain  @ jainayus...@gmail.com or
Ashish Jain @ 26may.1...@gmail.com
<><><><><><><><><><><><><><><><><><><><><><>
HELP US GROW !!

We reach over 6,500 subscribers worldwide and receive many nice notes about the 
learning and support from the group. Our goal is to have 10,000 subscribers by 
the end of 2009. Let friends and co-workers know they can subscribe to group at 
http://groups.google.com/group/excel-macros/subscribe
-~----------~----~----~----~------~----~------~--~---

Reply via email to