Solved

Can't populate text box when form opens

Posted on 2011-04-28
3
312 Views
Last Modified: 2012-05-11
I have a form that has a control, txtHoliday.  All I want is when this form opens, I want the box to fill with the holiday if it fall between Date-7 and Date+7.  But it simply keep erroring out.
Private Sub Form_Open(Cancel As Integer)
Dim dteHoliday As Date
dteHoliday = DMax("HolidayDate", "tblHolidays", "HolidayDate > Date() - 7 and HolidayDate < Date + 7")
    Me.cboAssociate = "<All>"
    Me.cboJobDay = "<All>"
    Me.cboProblemGroup = "<All>"
    Me.cboPeriod = "<All>"
    Me.cboAssociate.SetFocus
    Me.txtDate = Date
   Me.txtHoliday = dteHoliday
    
End Sub

Open in new window

0
Comment
Question by:ssmith94015
  • 2
3 Comments
 
LVL 5

Accepted Solution

by:
Scay7 earned 500 total points
ID: 35486750
dteHoliday = DMax("HolidayDate", "tblHolidays", "HolidayDate > Date() - 7 and HolidayDate < Date + 7")

At the end of this "Date + 7" shouldnt that be "Date() + 7"
or visa versa
Middelish "date() -7" should be "Date - 7"

My 2 Cents :P
0
 

Author Closing Comment

by:ssmith94015
ID: 35486980
You are so observant!  I did not even see it.

Sandra
0
 
LVL 5

Expert Comment

by:Scay7
ID: 35487002
Np i code with Delphi and i do that to my self all the time :P lol
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

Suggested Solutions

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
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 …

685 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