?
Solved

autofill field 1 with "Yes" if date field not null

Posted on 2009-04-05
3
Medium Priority
?
528 Views
Last Modified: 2012-05-06
There are two fields: Orientation Yes/No (but I'm using TEXT not a check box) and Orientation DAte.  The default value for Orientation is "No".  How can I have that automatically change to "Yes" if a date is entered in the Orientation date field?  The client would like most viewers to see only Yes/No.  THanks.
0
Comment
Question by:schneider_ks
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 65

Accepted Solution

by:
rockiroads earned 1000 total points
ID: 24071793
so is this on the entry of a date? if so then use the afterupdate event. this is triggered each time you change the value

find your date in form design, look at its properties, go to events tab then click on the button for afterupdate then select code builder
say your control was called orientation_date and orientation (which you say is text so you want either yes or no displayed)


private sub orientation_date_afterupdate()

    'Check if date entered, if so set to yes
    if nz(me.orientation_date,"") <> "" then
        me.orientation = "Yes"
    else
        me.orientation = "No"
    end if
end sub

0
 

Author Closing Comment

by:schneider_ks
ID: 31566778
Excellent, Thanks so much
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 24071990
No probs.

fyi, not telling you to do this, just some advice from me

You know, its probably better to use a yesno control. You can always use code to display YesNo on a label perhaps. Say u had a label called lblYesNo, you set the text of it by using the Caption property

lblYesNo.Caption = "Yes"

Other thing is its recommended not to store calculated fields in a db. Given a date field, you can always determine this yesno either in a query or a form (like using
the label example)
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question