Solved

Can't populate text box when form opens

Posted on 2011-04-28
3
313 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
[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 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
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 …

751 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