dbTalk Databases Forums  

setting a control to default value

comp.databases.ms-access comp.databases.ms-access


Discuss setting a control to default value in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
sparks
 
Posts: n/a

Default setting a control to default value - 06-01-2011 , 09:31 AM






Since access 97 we have used this and it worked perfectly well to
reset something on an option group

double click =[settodeault]

Public Function SetToDefault() As Boolean
' Called from the double click event to set the value to the form
default value
Dim ctl As Control
Set ctl = Screen.ActiveControl
ctl = ctl.DefaultValue
ctl.Requery
End Function

in 2007 the =[settodeault]

the option does not contain automation object settodefault

is the only way I can change this is to go thru every old database and
change it to expression and then in the expression do a
call settodefault

Reply With Quote
  #2  
Old   
Marshall Barton
 
Posts: n/a

Default Re: setting a control to default value - 06-01-2011 , 01:36 PM






sparks wrote:

Quote:
Since access 97 we have used this and it worked perfectly well to
reset something on an option group

double click =[settodeault]

Public Function SetToDefault() As Boolean
' Called from the double click event to set the value to the form
default value
Dim ctl As Control
Set ctl = Screen.ActiveControl
ctl = ctl.DefaultValue
ctl.Requery
End Function

in 2007 the =[settodeault]

the option does not contain automation object settodefault

is the only way I can change this is to go thru every old database and
change it to expression and then in the expression do a
call settodefault

I have never seen that syntax in an event property.
According to VBA Help on "Event Properties", it should be:
=SetToDefault()

--
Marsh

Reply With Quote
  #3  
Old   
sparks
 
Posts: n/a

Default Re: setting a control to default value - 06-03-2011 , 09:59 AM



Thank you for that.
I went and looked and at some time people were using =SetToDefault()
and then it became =[settodeault]

it seems to work fine in 97 and 2003 but 2007 doesn't recognize it.



On Wed, 01 Jun 2011 13:36:05 -0500, Marshall Barton
<marshbarton (AT) wowway (DOT) com> wrote:

Quote:
sparks wrote:

Since access 97 we have used this and it worked perfectly well to
reset something on an option group

double click =[settodeault]

Public Function SetToDefault() As Boolean
' Called from the double click event to set the value to the form
default value
Dim ctl As Control
Set ctl = Screen.ActiveControl
ctl = ctl.DefaultValue
ctl.Requery
End Function

in 2007 the =[settodeault]

the option does not contain automation object settodefault

is the only way I can change this is to go thru every old database and
change it to expression and then in the expression do a
call settodefault


I have never seen that syntax in an event property.
According to VBA Help on "Event Properties", it should be:
=SetToDefault()

Reply With Quote
Reply




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.