Access 2007-2019
Access 2000-2003
Access Seminars
TechHelp Support
Tips & Tricks
Access Forum
Course Index
Topic Glossary
Insider Circle
 
Home   Courses   Seminars   Templates   Help   TechHelp   Forums   Contact   Join   Order   Logon  
 
Home > Forums > Access
 
Access Forum

Welcome to the Microsoft Access Forum. Access is by far our most popular topic here at Computer Learning Zone. This forum is for everyone to read but only students can post here. If you'd like to become a student, all you have to do is enroll in one of my courses, which you can do for as little as $1. After you create a logon, you will have full access to the Forums.

Subscribe to this forum and receive an email update whenever new posts are added. You will also be notified by email if any conversations you are involved in receieve new comments. Yes, even non-students can subscribe to update notifications.

NEW: Access Developer Students, make sure you subscribe to the Developer Student Forum.

Click Here to Post a comment and start a new discussion

Please read the FORUM RULES before posting.

 

Birthdate in Function Upload Images   Link 
Ina van Rooyen 
2 months ago
I want to use the birthdate as the date.  I tried it like this and inside quotes "birthdate" but it doesn't like it.
Public Sub UpdateAge()
    CurrentAge = Null    
    BirthDate = DLookup("BirthDate", "DogT", "DogID=" & DogID)
    If IsNull(BirthDate) Then Exit Sub
        HowLong(BirthDate, True, "ymd")
End Sub
Richard Rost
2 months ago
What do you mean by "it doesn't like it?" Are you getting an error message? If so, what is it? Which line? Read this please.

What are you doing with HowLong? It's a function that returns a value. So you'd need to say something like:

AgeFieldOnMyForm = HowLong(BirthDate, True, "ymd")

See Access Developer 2 for the difference between Subs and Functions.
Richard Rost
2 months ago
Also, the way you have that written, if there is no BirthDate in the table for that dog, it will return a NULL and throw an error. Wrap DLookups like that in Nz.

BirthDate = Nz(DLookup("BirthDate", "DogT", "DogID=" & DogID),0)
If BirthDate = 0 Then Exit Sub


Ina van Rooyen
2 months ago
Thank you, it's working perfectly now!
No error message, the line was red and I couldn't figure out why.
Richard Rost
2 months ago
Happy to help. Next time I need to know WHICH line was red. "It doesn't like it" doesn't tell me anything. :)

Glad it's working now. Enjoy!
Add a Reply

Show All Comments

Start a NEW Conversation
 
Only students may post right now. Click here for more information on how you can set up an account. If you are a student, please LOG ON first.
 
Subscribe
 

You may want to read these articles from the 599CD News:

10/21/2021Conditional Formatting
10/20/2021Text Messages
10/19/2021Late Binding
10/18/2021Open Form
10/17/2021Date Only?
10/16/2021Relink Tables
10/16/2021Access Developer 34
10/16/2021Access Developer 34 Lessons
10/16/2021Access Developer 34
10/10/2021Copy Text from Field
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Account Login
Online Theater
Downloads
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Email Richard
Mailing Address
Phone Number
Fax Number
Course Survey
Blog RSS Feed    Twitter

YouTube Channel    LinkedIn
Keywords: microsoft access forum  PermaLink