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 / Macros / February 2008

Tip: Looking for answers? Try searching our database.

Macro using DLookup Function

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
pedro - 27 Feb 2008 09:10 GMT
I would like to create a macro that auto populates a check box based on a
selection from a drop down list in another field on the same form.

The field is called 'Status' and when I select 'Resolved' from a drop down
list (the list is based on a table) I would like the check box to populate
with a 'tick'.

I guess I would use the after update event in the Status field then use the
'set value' macro. I'm not sure if I should use a DLookup function as the
condition of the macro.

Any ideas on have this may look?

thanks
Steve Schapel - 27 Feb 2008 19:31 GMT
Pedro,

You could do it as you suggested.  In that case, the Condition for the
SetValue action will simply be:
[Status]="Resolved"

However, I should also say that to have the value of one field dependent
on the value of another would normally indicate an incorrect data
design.  So I really suspect that what you are doing here is faulty.
Let us know if you would like to explore this aspect.

Signature

Steve Schapel, Microsoft Access MVP

> I would like to create a macro that auto populates a check box based on a
> selection from a drop down list in another field on the same form.
[quoted text clipped - 10 lines]
>
> thanks
pedro - 28 Feb 2008 00:44 GMT
Thanks for that.

I think I need to do the reverse - auto populate the status field if the
check box is clicked - ie when check box is 'ticked' status becomes 'Resolved'

I have tried to create this macro using the 'on click' event for the check
box and using a 'setvalue' macro where the condition is set to [checkbox] =
yes.

However I am not sure what to enter for the Item and Expression fields for
the macro. I have set the expression to where status = 'Resolved' however
when I test the macro and click the check box the status field changes to 0
or -1 (reflecting the values of the check box.

any ideas?

thanks.

> Pedro,
>
[quoted text clipped - 21 lines]
> >
> > thanks
Steve Schapel - 28 Feb 2008 04:42 GMT
Pedro,

I can now confirm my previous concerns...  What you are doing here is
incorrect practice in a database.

With that proviso (i.e. proceed at your own risk!), the Arguments of the
SetValue macro action would be..

Condition: [checkbox]<>0
Item: [Status]
Expression: "Resolved"

This macro would go on the checkbox's After Update event.

Signature

Steve Schapel, Microsoft Access MVP

> Thanks for that.
>
[quoted text clipped - 11 lines]
>
> any ideas?
pedro - 28 Feb 2008 00:39 GMT
Thanks for that.

I think I need to do the reverse - auto populate the status field if the
check box is clicked - ie when check box is 'ticked' status becomes 'Resolved'

I have tried to create this macro using the 'on click' event for the check
box and using a 'setvalue' macro where the condition is set to [checkbox] =
yes.

However I am not sure what to enter for the Item and Expression fields for
the macro. I have set the expression to where status = 'Resolved' however
when I test the macro and click the check box the status field changes to 0
or -1 (reflecting the values of the check box.

any ideas?

thanks.

> I would like to create a macro that auto populates a check box based on a
> selection from a drop down list in another field on the same form.
[quoted text clipped - 10 lines]
>
> thanks
 
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.