Solved

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

Posted on 2009-04-05
3
513 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 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

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.
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

707 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