I think you want to edit the DefaultValue property of the TableDef instead
of creating a new property.

For example:

tdfTable.Fields!FieldName.DefaultValue = "EnterValueHere"

OR

tdfField.DefaultValue = "EnterValueHere"


HTH,
Toby

----- Original Message ----- 
From: "vjcross2004" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Thursday, September 22, 2005 9:39 AM
Subject: [AccessDevelopers] Re: Modify table in backend with code?


> Thanks for your advice. Network admin won't even give me a network
> login username when I'm on site - so I can't imagine they would let
> me use PCanywhere etc!
>
> I tried to do this years ago, on a old, old version of access & at
> the time there was no way of doing it - Access didn't have the
> capability. As you suggest I've got the 'modify' code in a temporary
> database, which someone can run for me on site. I've now tried with
> table defs again & have persisted & have now managed to get the
> correct syntax & have sucessfully added new fields to remote tables.
> So I'm happy.
> But, I'm now trying to change some of the properties of the new
> field, eg I want to set the default value. This is what I've tried.
> It creates the new field OK, but doesn't set the default value.
>
> Set dbsUpdate = wrkDefault.OpenDatabase(linkpath, True)
> Set tdfUpdate = dbsUpdate.TableDefs(TableName)
> With tdfUpdate
>   Set tdfField = .CreateField(fieldname, dbBoolean)
>   tdfField.Properties.Append tdfField.CreateProperty("Default",
> dbText, "False") ' This line does nothing
>  .Fields.Append tdfField
> End With
>
> Does anyone have a suggestions?
> Jane
>
> --- In [email protected], "Databasedude.com"
> <[EMAIL PROTECTED]> wrote:
> > Have you ruled out remote connection to their system using
> GoToMyPC,
> > pcAnywhere, or other such services? That would let you have the
> > necessary hands-on.
> >
> > Aside from that, here's an idea I've used successfully several
> times
> > with remote clients: Create a temporary MDB that someone at the
> client
> > will execute, and then discard.
> >
> > This MDB would contain code to add the field to the table ...
> refer to
> > DAO tabledefs etc for instructions in VBA.
> >
> > Once you've tested to make sure it works on a copy of their back-
> end,
> > then submit it to your main contact person, ask them to run it for
> you
> > (preferably with everyone out of the data), and problem solved.
> >
> > HTH
> > Bryant
> >
> > --- In [email protected], "vjcross2004"
> <[EMAIL PROTECTED]>
> > wrote:
> > > Thanks for that, but I don't know of anyway of 'putting'
> anything
> > > into the backend to run, unless anyone has any suggestions.
> > > I am trying to avoid visiting the client (2 hrs travelling) for
> a 2
> > > minute job.
> > > Thanks
> > > Jane
> > >
> > > --- In [email protected], [EMAIL PROTECTED] wrote:
> > > > I would personally use SQL ALTER TABLE statement.
> > > >
> > > > ALTER TABLE tblName ADD TextField VARCHAR(30); 'to add a 30
> > > character text
> > > > field called TextField to table tblName.
> > > >
> > > > My guess is you must run this in the back end. Google ALTER
> TABLE
> > > and check
> > > > syntax for other data types and keys and indexes if necessary
> > > >
> > > > Hal McGee
> > > > Engineering Data Manager
> > > > Group Engineering - Process and Compliance
> > > > Seating Products Group
> > > > B/E Aerospace
> > > > Winston-Salem, NC
> > > >
> > > >
> > >
> >
> > >
> > >
> >              "vjcross2004"
> > >
> > > >
> > > <[EMAIL PROTECTED]
> > > >
> > > ucts.plus.com>                                             To
> > > >              Sent by:
> > > [email protected]
> > > >
> > > AccessDevelopers@                                          cc
> > > >
> > > yahoogroups.com
> > >
> >
> > > Subject
> > > >                                        [AccessDevelopers]
> Modify
> > > table in
> > > >              09/22/2005 07:33          backend with
> > > code?
> > > >
> > > AM
> > >
> >
> > >
> > >
> >
> > >
> > > >              Please respond
> > > to
> > > >
> > > AccessDevelopers@
> > > >
> > > yahoogroups.com
> > >
> >
> > >
> > >
> >
> > >
> > > >
> > > >
> > > >
> > > >
> > > > I have a database split as FE/BE at a clients office. I need
> to
> > > add a
> > > > new field to one of the tables in the backend, using code
> which
> > > will
> > > > run once when the FE is first opened. I can use TableDefs OK
> to
> > > modify
> > > > tables within the existing FE, but not those linked from the
> BE.
> > > This
> > > > is a one time only event & all the users can be forced out of
> the
> > > > database before the change happens.
> > > >
> > > > Does anyone have any suggestions as to how to do it?
> > > > Thanks
> > > > Jane
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > Please zip all files prior to uploading to Files section.
> > > >
> > > >
> > > >                             YAHOO! GROUPS LINKS
> > > >
> > > >        Visit your group "AccessDevelopers" on the web.
> > > >
> > > >        To unsubscribe from this group, send an email to:
> > > >        [EMAIL PROTECTED]
> > > >
> > > >        Your use of Yahoo! Groups is subject to the Yahoo!
> Terms of
> > > Service.
>
>
>
>
>
>
>
> Please zip all files prior to uploading to Files section.
> Yahoo! Groups Links
>
>
>
>
>
>
>



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life.
http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/q7folB/TM
--------------------------------------------------------------------~-> 


Please zip all files prior to uploading to Files section. 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/AccessDevelopers/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to