OPtion Group

P

Phil

Apologies if you have already seen this question I posted it yesterday but
could not find it this morning.

I have a form in a A2000 database that shows course details at the moment I
have it set to only show future courses by using >Date() in the startdate. I
would like to have an option group to be able to switch between all courses
and future courses.

I have never used an option group before:

I created an option group called [Courses] with two options 1. Future
Courses 2. Alll Courses.

In the After update event for courses I have put:

Select Case Me!Courses
Case 1
Me!Courses = ">Date()"

Case 2
Me!Courses = ""

End Select

I have also put this in the on load event for the form. and in the query
the form is based on under startdate I have added

=Forms!Events!Courses

This does nothing at all the form loads with no data and has does not change
if you change the option group

I hope someone can help

Thanks

Phil
 
P

Phil

Sorry for cross posting, I am lumbered with IE6 at work and it sometimes
hangs when posting

Already answered in New Users
 
A

Al Campagna

Phil,
If you look at your code, you'll see that you're taking the value of an
OptionGroup named Courses, which can have a value of 1 or 2, and then trying
to set Courses to a string value of... ">Date()"
Using the name optCourseDate for your OptionGroup... and CourseDate as
the field in your table that you want to filter on.
Check out Filter Property in Access Help, as to how to define a filter,
and apply it.

Using the AfterUpdate event of optCourseDate, you want to filter the
current recordset.
(set the form's AllowFilters = yes)

Private Sub optCourseDate_AfterUpdate()
Select Case optCourseDate
Case 1
Me.Filter = "CourseDate > Date()" ' the future filter
Me.FilterOn = True ' applies that filter
Case 2
Me.FilterOn = False ' removes the filter
End Select
End Sub
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 
P

Phil

Thanks AL

Thanks for taking the time to respond and for the explanation

thanks

Phil



Al Campagna said:
Phil,
If you look at your code, you'll see that you're taking the value of an
OptionGroup named Courses, which can have a value of 1 or 2, and then trying
to set Courses to a string value of... ">Date()"
Using the name optCourseDate for your OptionGroup... and CourseDate as
the field in your table that you want to filter on.
Check out Filter Property in Access Help, as to how to define a filter,
and apply it.

Using the AfterUpdate event of optCourseDate, you want to filter the
current recordset.
(set the form's AllowFilters = yes)

Private Sub optCourseDate_AfterUpdate()
Select Case optCourseDate
Case 1
Me.Filter = "CourseDate > Date()" ' the future filter
Me.FilterOn = True ' applies that filter
Case 2
Me.FilterOn = False ' removes the filter
End Select
End Sub
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."

Phil said:
Apologies if you have already seen this question I posted it yesterday but
could not find it this morning.

I have a form in a A2000 database that shows course details at the moment
I
have it set to only show future courses by using >Date() in the startdate.
I
would like to have an option group to be able to switch between all
courses
and future courses.

I have never used an option group before:

I created an option group called [Courses] with two options 1. Future
Courses 2. Alll Courses.

In the After update event for courses I have put:

Select Case Me!Courses
Case 1
Me!Courses = ">Date()"

Case 2
Me!Courses = ""

End Select

I have also put this in the on load event for the form. and in the query
the form is based on under startdate I have added

=Forms!Events!Courses

This does nothing at all the form loads with no data and has does not
change
if you change the option group

I hope someone can help

Thanks

Phil
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top