Solved

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

Posted on 2009-04-05
3
507 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
  • 2
3 Comments
 
LVL 65

Accepted Solution

by:
rockiroads earned 250 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

831 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