Refreshing a form in ADP

A

AkAlan

I have a form "frmAirspaceBlockSched" that is bound to a View and I open it
to the date selected on a Calender Control with the following VBA code:

stLinkCriteria = "DateSched = '" _
& Format(ocxcalender.Object.Value, "yyyy-mm-dd") & "'"

DoCmd.OpenForm "frmAirspaceBlockSched", , , stLinkCriteria

This works just fine but once the user is on the form
"frmAirspaceBlockSched" I want them to be able to move to the next and/or the
previous day. I use the DateAdd function to change the Calender value and
then try to refresh the from using the following code:
Me.Filter = "[DateSched]=" _
& Format(Form_frmSwitchboard.ocxcalender.Value, "yyyy-mm-dd") & "'"

This worked fine as an MDB but errors out now. I'm thinking I should use a
stored procedure but not sure if there isn't a way to make this work. Any
ideas? Thanks for helping.
 
A

AkAlan

I figured it out. I needed to change the ServerFilter not just the filter, so
here is what the code looks like that works for the Previous Day command
button:

Form_frmSwitchboard.ocxcalender.Value = DateAdd("d", -1, Me.txtHeaderDate)
Me.Refresh
Me.ServerFilter = "DateSched= '" &
Format(Form_frmSwitchboard.ocxcalender.Value, "yyyy-mm-dd") & "'"
 
Top