Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / December 2005

Tip: Looking for answers? Try searching our database.

setting default in control

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
BobbyS - 29 Dec 2005 18:21 GMT
I have a form (frmMaintenance) with a checkbox on it. I want to be able to
change the default by looking at a table (tblSys) and setting the default
value by getting that value found in the table. The description field will
either contain =Yes or =No depending on what I am doing at the time.

Table structure:
TblName: tblSys
                   (f1) Comparison            (f2) ReturnVal     (f3)
Description
cur values:            Username                    BobbyS                =Yes

My understanding is that I can set the default value of the checkbox to
equal the value in the Description field. I have put the following in the
default value of the checkbox (name: chkIt):

=DLookup("[Description]", "tblSys", "[Comparison]"="""Username")

This doesn't seem to work. What am I doing wrong?

Also, can I create a variable = the dlookup above and then change the
Description field to =No or do I have to go about it another way?

Thank you.
John Griffiths - 29 Dec 2005 19:52 GMT
not checked your problem but
=DLookup("[Description]", "tblSys", "[Comparison]"="""Username")

should be
=DLookup("[Description]", "tblSys", "[Comparison]=""" & CurrentUser() &
"""")

to make more sense - John

I'm not sure of which versions "CurrentUser()" applies to, check current
usage in help.

> I have a form (frmMaintenance) with a checkbox on it. I want to be able to
> change the default by looking at a table (tblSys) and setting the default
[quoted text clipped - 19 lines]
>
> Thank you.
MacDermott - 30 Dec 2005 03:03 GMT
Setting the default value of a control sets the value which is entered in a
new record.
It has no effect on existing records.
If this isn't enough to answer your question, perhaps you can provide a bit
more explanation of how you intend to use this default value.

For your second question, too, it would be useful to understand more of what
you hope to accomplish by doing this.

> I have a form (frmMaintenance) with a checkbox on it. I want to be able to
> change the default by looking at a table (tblSys) and setting the default
[quoted text clipped - 19 lines]
>
> Thank you.
BobbyS - 30 Dec 2005 03:41 GMT
Hope this explanation makes sense. I have a switchboard with a button that
allows the user to delete test/dummy records. When they click the button a
form (frmDelTests) opens with a warning and instructions as to what is going
to happen. When the user selects the button to delete the data, I want the
button's visible property on the switchboard form (frmMaintenance) set to No
so that from that point on, enen when the database is opened the next time,
the button does not appear. I created the table referred to previously to
store a username and then using the =Yes or =No in the table to set the value
of the checkbox. Then, on the switchboards on load event, check the value to
determine if the button was visible or not. I suppose it would be alright to
delete the button on the switchboard, but it looks like I would have the same
problem as setting the default value.

I can get the button's visible property to change while the form is open but
not permanently. As soon as the form is closed and reopened, the buttons
reappear.

I hope that what I am trying to do can be done. If so, I really need some
help.

Thanks

> Setting the default value of a control sets the value which is entered in a
> new record.
[quoted text clipped - 29 lines]
> >
> > Thank you.
MacDermott - 31 Dec 2005 19:06 GMT
I think this could work fine - you just need to set the checkbox's actual
value, not its defaultvalue.

> Hope this explanation makes sense. I have a switchboard with a button that
> allows the user to delete test/dummy records. When they click the button a
[quoted text clipped - 51 lines]
> > >
> > > Thank you.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.