Solved

Can't populate text box when form opens

Posted on 2011-04-28
3
308 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
Comment Utility
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
Comment Utility
You are so observant!  I did not even see it.

Sandra
0
 
LVL 5

Expert Comment

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

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

This collection of functions covers all the normal rounding methods of just about any numeric value.
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …

771 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now