Oleg_123 at xuppa.com
Oleg_123 at xuppa.com
Wed Feb 5 15:53:00 CST 2003
thanks Andy, i get a type mismatch on this line - Set fldLoop = tbGAP.CreateField("PriKey", dbLong) (but I still have a month before my vacation, so I'll figure this out :)) > Sorry, Oleg, that was a reply with no thought attached. Try this - you > did say it's adding a field to an existing table > > Dim dbDM As Database > Dim tbGAP As TableDef > Dim fldLoop As Field > > Set dbDM = OpenDatabase("Your.mdb") > Set tbGAP = dbDM.TableDefs("Yourtable") > > Set fldLoop = tbGAP.CreateField("PriKey", dbLong) > fldLoop.Attributes = dbAutoIncrField > tbGAP.Fields.Append fldLoop > > Set fldLoop = Nothing > Set tbGAP = Nothing > Set dbDM = Nothing > > Andy Lacey > http://www.minstersystems.co.uk > > > >> -----Original Message----- >> From: accessd-admin at databaseadvisors.com >> [mailto:accessd-admin at databaseadvisors.com] On Behalf Of Andy Lacey >> Sent: 05 February 2003 20:42 >> To: accessd at databaseadvisors.com >> Subject: RE: [AccessD] adding field to table via code >> >> >> No space before Createfield >> >> Andy Lacey >> http://www.minstersystems.co.uk >> >> >> >> > -----Original Message----- >> > From: accessd-admin at databaseadvisors.com >> > [mailto:accessd-admin at databaseadvisors.com] On Behalf Of >> > Oleg_123 at xuppa.com >> > Sent: 05 February 2003 20:16 >> > To: accessd at databaseadvisors.com >> > Subject: RE: [AccessD] adding field to table via code >> > >> > >> > Andy, Charlotte was right i had to go to vb help not Access, >> > well Isleep 5 hours a day (thats why i am going on vacation >> > :) I am gtting error in >> > this line --- .Fields.Append. CreateField("PriKey", dbAutonumber) >> > >> > Dim dbDM As Database >> > Dim tbGAP As TableDef >> > Dim fldLoop As Field >> > Dim tdfNew >> > >> > Set dbDM = OpenDatabase("Daily MIS.mdb") >> > Set tbGAP = dbDM.CreateTableDef("NewTableDef") >> > >> > With tbGAP >> > .Fields.Append. CreateField("PriKey", dbAutonumber) >> > End With >> > >> > dbDM.TableDefs.Append tdfNew >> > >> > MsgBox "Properties of new Fields in " & tdfNew.Name >> > >> > >> > >> > >> > > Don't know why Help's not helping. Try going via the >> > TableDef object, >> > > cos it's one of its methods. BTW what version of Access? >> > > >> > > Andy Lacey >> > > http://www.minstersystems.co.uk >> > > >> > > >> > > >> > >> -----Original Message----- >> > >> From: accessd-admin at databaseadvisors.com >> > >> [mailto:accessd-admin at databaseadvisors.com] On Behalf Of >> > >> Oleg_123 at xuppa.com >> > >> Sent: 05 February 2003 19:33 >> > >> To: accessd at databaseadvisors.com >> > >> Subject: RE: [AccessD] adding field to table via code >> > >> >> > >> >> > >> yeah, I made it :)) >> > >> If i type it in one word in help (like u did) i get no >> > results, if i >> > >> tpe 2 words it tels me how to add a field in design view >> > or datasheet >> > >> view (which I had basically known for the last couple of >> years :)) >> > >> >> > >> ---------------------------------------------- >> > >> >> > >> > Hi Oleg, you made it :-) >> > >> > >> > >> > Yep to your question. See the CreateField method in Help. >> > >> Post again >> > >> > if you want help. >> > >> > >> > >> > Andy Lacey >> > >> > http://www.minstersystems.co.uk >> > >> > >> > >> > >> > >> > >> > >> >> -----Original Message----- >> > >> >> From: accessd-admin at databaseadvisors.com >> > >> >> [mailto:accessd-admin at databaseadvisors.com] On Behalf Of >> Oleg_123 at xuppa.com >> > >> >> Sent: 05 February 2003 15:34 >> > >> >> To: accessd at databaseadvisors.com >> > >> >> Subject: [AccessD] adding field to table via code >> > >> >> >> > >> >> >> > >> >> Hey, I have a query one of it's components is a table that >> > >> I convert >> > >> >> daily from an Excel file (which is being sent daily)In >> > >> order for the >> > >> >> query to operate that table must have an autonumber (since >> > >> they are >> > >> >> always in the same order)So every day I manually add that >> > >> field with >> > >> >> an autonumber, which takes less then 2 min. However I am >> > >> going for a >> > >> >> couple of weeks, and I don't want to confuse the person >> > >> who's going >> > >> >> to be doing to be running reports while i am gone; So >> my questin >> > >> is, can I write a vba procedure on button click that would >> > >> >> add that field >> > >> >> >> > >> >> oleg? >> > >> >> >> > >> >> >> > >> >> ----------------------------------------- >> > >> >> Send a Xuppa Valentine to Your Sweetheart today! >> > >> > http://www.xuppa.com/greet/ >> > >> > >> > >> > >> > >> > _______________________________________________ >> > >> > AccessD mailing list >> > >> > AccessD at databaseadvisors.com >> > >> > http://databaseadvisors.com/mailman/listinfo/accessd >> > >> > Website: http://www.databaseadvisors.com >> > >> > >> > >> > >> > >> > _______________________________________________ >> > >> > AccessD mailing list >> > >> > AccessD at databaseadvisors.com >> > >> > http://databaseadvisors.com/mailman/listinfo/accessd >> > >> > Website: http://www.databaseadvisors.com >> > >> >> > >> >> > >> >> > >> ----------------------------------------- >> > >> Send a Xuppa Valentine to Your Sweetheart today! >> > > http://www.xuppa.com/greet/ >> > > >> > > >> > > _______________________________________________ >> > > AccessD mailing list >> > > AccessD at databaseadvisors.com >> > > http://databaseadvisors.com/mailman/listinfo/accessd >> > > Website: http://www.databaseadvisors.com >> > > >> > > _______________________________________________ >> > > AccessD mailing list >> > > AccessD at databaseadvisors.com >> > > http://databaseadvisors.com/mailman/listinfo/accessd >> > > Website: http://www.databaseadvisors.com >> > >> > >> > >> > ----------------------------------------- >> > Send a Xuppa Valentine to Your Sweetheart today! >> http://www.xuppa.com/greet/ >> >> >> _______________________________________________ >> AccessD mailing list >> AccessD at databaseadvisors.com >> http://databaseadvisors.com/mailman/listinfo/accessd >> Website: http://www.databaseadvisors.com >> >> >> _______________________________________________ >> AccessD mailing list >> AccessD at databaseadvisors.com >> http://databaseadvisors.com/mailman/listinfo/accessd >> Website: http://www.databaseadvisors.com >> >> > > _______________________________________________ > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com ----------------------------------------- Send a Xuppa Valentine to Your Sweetheart today! http://www.xuppa.com/greet/