Link to home
Start Free TrialLog in
Avatar of Sandra Smith
Sandra SmithFlag for United States of America

asked on

Can't populate text box when form opens

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

ASKER CERTIFIED SOLUTION
Avatar of Scay7
Scay7
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Sandra Smith

ASKER

You are so observant!  I did not even see it.

Sandra
Np i code with Delphi and i do that to my self all the time :P lol