User defined form load options

  • Follow


Greetings all.  I am using Access 2003 .ADP with SQL Server 2000.  I have a
search popup where the user makes choices from some combos, and the SQL is
generated behind the scenes.  I have been asked to include some option
buttons that could be used to further restrict the records.  So far I have
two option buttons, and I have set the default value to -1 on the form's load
event, like the below...

Private Sub Form_Load()
On Error GoTo Err_Form_Load
  
    Me.optExcludeComplete = -1
    Me.optExcludeSplitter = -1

Exit_Form_Load:
    Exit Sub
    
Err_Form_Load:
    MsgBox Err.description
    Resume Exit_Form_Load

End Sub

My question is, if a user wants the default for either or both of them to be
0 instead of -1, how can I approach this.  It seems like I would need to
allow users to alter the sub, and I'm not sure how I could do this.  Thank
you

Greg

-- 
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/201001/1

0
Reply gsnidow 1/13/2010 3:19:41 PM

"gsnidow via AccessMonster.com" <u33475@uwe> wrote in message 
news:a20de0925fbd9@uwe...
> Greetings all.  I am using Access 2003 .ADP with SQL Server 2000.  I have 
> a
> search popup where the user makes choices from some combos, and the SQL is
> generated behind the scenes.  I have been asked to include some option
> buttons that could be used to further restrict the records.  So far I have
> two option buttons, and I have set the default value to -1 on the form's 
> load
> event, like the below...
>
> Private Sub Form_Load()
> On Error GoTo Err_Form_Load
>
>    Me.optExcludeComplete = -1
>    Me.optExcludeSplitter = -1
>
> Exit_Form_Load:
>    Exit Sub
>
> Err_Form_Load:
>    MsgBox Err.description
>    Resume Exit_Form_Load
>
> End Sub
>
> My question is, if a user wants the default for either or both of them to 
> be
> 0 instead of -1, how can I approach this.  It seems like I would need to
> allow users to alter the sub, and I'm not sure how I could do this.  Thank
> you
>
> Greg


Do you mean that different users should be able to set a preference for the 
default values of these option groups?  You'd need to store those 
preferences somewhere.  One way to do this would be to have a configuration 
table of some sort, indexed by user.  Another way would be to store them as 
custom properties of the form.  Either way, your Form_Load procedure would 
be modified to get the user's preferences from wherever they were stored, 
and use them to set the initial values of the option groups.

-- 
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html

(please reply to the newsgroup)

0
Reply Dirk 1/13/2010 3:47:31 PM


Thanks Dirk.  I was thinking I would have to go the table route, and that
will probably be easiest.  I was not sure if there was another way.  Thanks
for the quick reply.

Dirk Goldgar wrote:
>> Greetings all.  I am using Access 2003 .ADP with SQL Server 2000.  I have 
>> a
>[quoted text clipped - 27 lines]
>>
>> Greg
>
>Do you mean that different users should be able to set a preference for the 
>default values of these option groups?  You'd need to store those 
>preferences somewhere.  One way to do this would be to have a configuration 
>table of some sort, indexed by user.  Another way would be to store them as 
>custom properties of the form.  Either way, your Form_Load procedure would 
>be modified to get the user's preferences from wherever they were stored, 
>and use them to set the initial values of the option groups.
>

-- 
Message posted via http://www.accessmonster.com

0
Reply gsnidow 1/13/2010 4:16:52 PM

2 Replies
186 Views

(page loaded in 0.069 seconds)

Similiar Articles:
















7/11/2012 1:57:15 PM


Reply: