[Event Procedure] Help

F

Frustrated

Hi if you can help i have a Form on our Club Database Access 2002 i want to
be able to create an [Event Procedure] on the form that will allow me to
search a Field Name "DateofRenewal" for all data between two dates and
possibly attache this Event to a button?
 
K

Klatuu

Your question is a bit vague to answer in detail, but to create an event
procedure for a command button, you open the properties dialog box for the
button, select the Events tab and click the small command button with the 3
dots on it just to the right of the On Click event text box. Then select Code
Builder from the popup menu.

The VB Editor will open with the cursor positioned in the sub for the event.

Now, you have to create the code you need to return the data. If you are
going to search for data within a range of dates, you will need two text
boxes on your form for the Start and End dates. What you do next depends on
where the data is you want to retrieve and what you want to do with it.

If you can provide a bit more detail, perhaps we can explain how to get what
you want.
 
F

Frustrated

Ok
I only have One Field with Dates in it. I want to be able to click on the
command button and be offered a start date dialogue box and then a end date
dialogue box the dates i type in are is the range i want to show all records
for that are within the dates entered. I know in query "Between [Start Date]
and [End Date]" will work but i was hoping to do this in a form

Klatuu said:
Your question is a bit vague to answer in detail, but to create an event
procedure for a command button, you open the properties dialog box for the
button, select the Events tab and click the small command button with the 3
dots on it just to the right of the On Click event text box. Then select Code
Builder from the popup menu.

The VB Editor will open with the cursor positioned in the sub for the event.

Now, you have to create the code you need to return the data. If you are
going to search for data within a range of dates, you will need two text
boxes on your form for the Start and End dates. What you do next depends on
where the data is you want to retrieve and what you want to do with it.

If you can provide a bit more detail, perhaps we can explain how to get what
you want.
--
Dave Hargis, Microsoft Access MVP


Frustrated said:
Hi if you can help i have a Form on our Club Database Access 2002 i want to
be able to create an [Event Procedure] on the form that will allow me to
search a Field Name "DateofRenewal" for all data between two dates and
possibly attache this Event to a button?
 
K

Klatuu

I would suggest ubound controls on your form to enter the date range.
If you want to use a popup form to enter the dates, that is okay, but it
does complicate the coding to some degree.
You could open a form where you could enter the dates and run the report
form that form. That would be about the most simple way to do it.

I do something similar in one of my apps, but it is a tab on the main
dashboard form for selecting reports. Once the user chooses a report from a
combo box that lists all the reports, they use a command button to run the
report. The command button one of 3 for preview, print, or export to Excel.
All 3 buttons open a form the user uses to select parameters depending on the
report.
Then, in the Close event of the report, I close the form that opened it.
It is a bit different when the user selects to export to Excel, but that is
the basics of it.
--
Dave Hargis, Microsoft Access MVP


Frustrated said:
Ok
I only have One Field with Dates in it. I want to be able to click on the
command button and be offered a start date dialogue box and then a end date
dialogue box the dates i type in are is the range i want to show all records
for that are within the dates entered. I know in query "Between [Start Date]
and [End Date]" will work but i was hoping to do this in a form

Klatuu said:
Your question is a bit vague to answer in detail, but to create an event
procedure for a command button, you open the properties dialog box for the
button, select the Events tab and click the small command button with the 3
dots on it just to the right of the On Click event text box. Then select Code
Builder from the popup menu.

The VB Editor will open with the cursor positioned in the sub for the event.

Now, you have to create the code you need to return the data. If you are
going to search for data within a range of dates, you will need two text
boxes on your form for the Start and End dates. What you do next depends on
where the data is you want to retrieve and what you want to do with it.

If you can provide a bit more detail, perhaps we can explain how to get what
you want.
--
Dave Hargis, Microsoft Access MVP


Frustrated said:
Hi if you can help i have a Form on our Club Database Access 2002 i want to
be able to create an [Event Procedure] on the form that will allow me to
search a Field Name "DateofRenewal" for all data between two dates and
possibly attache this Event to a button?
 
F

Frustrated

I agree it would be easier to do an unbound control, however i will not be
entering data and the girl that is wants it to filter on a form? Instead of a
query. Anyhow I came up with this.

Private Sub cmdDateFilter_Click()
Dim strTemp As String
Dim strFilter As String

strTemp = InputBox("Please enter start date", "Date", Date)
If IsDate(strTemp) = False Then
MsgBox strTemp & " is not a valid date!"
Exit Sub
End If
strFilter = "[DateofRenewal] >= #" & Format(strTemp, "DD-MMM-YYYY") & "#"

strTemp = InputBox("Please enter an end date", "Date", Date)
If IsDate(strTemp) = False Then
MsgBox strTemp & " is not a valid date!"
Exit Sub
End If
strFilter = strFilter & " AND [DateofRenewal] <= #" & Format(strTemp,
"DD-MMM-YYYY") & "#"

Me.Filter = strFilter
Me.FilterOn = True


MsgBox "Your records are now filtered: " & vbNewLine & vbNewLine &
strFilter

End Sub

Klatuu said:
I would suggest ubound controls on your form to enter the date range.
If you want to use a popup form to enter the dates, that is okay, but it
does complicate the coding to some degree.
You could open a form where you could enter the dates and run the report
form that form. That would be about the most simple way to do it.

I do something similar in one of my apps, but it is a tab on the main
dashboard form for selecting reports. Once the user chooses a report from a
combo box that lists all the reports, they use a command button to run the
report. The command button one of 3 for preview, print, or export to Excel.
All 3 buttons open a form the user uses to select parameters depending on the
report.
Then, in the Close event of the report, I close the form that opened it.
It is a bit different when the user selects to export to Excel, but that is
the basics of it.
--
Dave Hargis, Microsoft Access MVP


Frustrated said:
Ok
I only have One Field with Dates in it. I want to be able to click on the
command button and be offered a start date dialogue box and then a end date
dialogue box the dates i type in are is the range i want to show all records
for that are within the dates entered. I know in query "Between [Start Date]
and [End Date]" will work but i was hoping to do this in a form

Klatuu said:
Your question is a bit vague to answer in detail, but to create an event
procedure for a command button, you open the properties dialog box for the
button, select the Events tab and click the small command button with the 3
dots on it just to the right of the On Click event text box. Then select Code
Builder from the popup menu.

The VB Editor will open with the cursor positioned in the sub for the event.

Now, you have to create the code you need to return the data. If you are
going to search for data within a range of dates, you will need two text
boxes on your form for the Start and End dates. What you do next depends on
where the data is you want to retrieve and what you want to do with it.

If you can provide a bit more detail, perhaps we can explain how to get what
you want.
--
Dave Hargis, Microsoft Access MVP


:

Hi if you can help i have a Form on our Club Database Access 2002 i want to
be able to create an [Event Procedure] on the form that will allow me to
search a Field Name "DateofRenewal" for all data between two dates and
possibly attache this Event to a button?
 
L

Ledo

Klatuu said:
I would suggest ubound controls on your form to enter the date range.
If you want to use a popup form to enter the dates, that is okay, but it
does complicate the coding to some degree.
You could open a form where you could enter the dates and run the report
form that form. That would be about the most simple way to do it.

I do something similar in one of my apps, but it is a tab on the main
dashboard form for selecting reports. Once the user chooses a report from a
combo box that lists all the reports, they use a command button to run the
report. The command button one of 3 for preview, print, or export to Excel.
All 3 buttons open a form the user uses to select parameters depending on the
report.
Then, in the Close event of the report, I close the form that opened it.
It is a bit different when the user selects to export to Excel, but that is
the basics of it.
--
Dave Hargis, Microsoft Access MVP


Frustrated said:
Ok
I only have One Field with Dates in it. I want to be able to click on the
command button and be offered a start date dialogue box and then a end date
dialogue box the dates i type in are is the range i want to show all records
for that are within the dates entered. I know in query "Between [Start Date]
and [End Date]" will work but i was hoping to do this in a form

Klatuu said:
Your question is a bit vague to answer in detail, but to create an event
procedure for a command button, you open the properties dialog box for the
button, select the Events tab and click the small command button with the 3
dots on it just to the right of the On Click event text box. Then select Code
Builder from the popup menu.

The VB Editor will open with the cursor positioned in the sub for the event.

Now, you have to create the code you need to return the data. If you are
going to search for data within a range of dates, you will need two text
boxes on your form for the Start and End dates. What you do next depends on
where the data is you want to retrieve and what you want to do with it.

If you can provide a bit more detail, perhaps we can explain how to get what
you want.
--
Dave Hargis, Microsoft Access MVP


:

Hi if you can help i have a Form on our Club Database Access 2002 i want to
be able to create an [Event Procedure] on the form that will allow me to
search a Field Name "DateofRenewal" for all data between two dates and
possibly attache this Event to a button?
 
L

Ledo

This is exactly what I would like to do with a form I am currently building
but do not have the experience for it. Can you give some more in depth
information on how to activate the pop up form and export to Excel? Any help
would be greatly appreciated.

Ledo

Klatuu said:
I would suggest ubound controls on your form to enter the date range.
If you want to use a popup form to enter the dates, that is okay, but it
does complicate the coding to some degree.
You could open a form where you could enter the dates and run the report
form that form. That would be about the most simple way to do it.

I do something similar in one of my apps, but it is a tab on the main
dashboard form for selecting reports. Once the user chooses a report from a
combo box that lists all the reports, they use a command button to run the
report. The command button one of 3 for preview, print, or export to Excel.
All 3 buttons open a form the user uses to select parameters depending on the
report.
Then, in the Close event of the report, I close the form that opened it.
It is a bit different when the user selects to export to Excel, but that is
the basics of it.
--
Dave Hargis, Microsoft Access MVP


Frustrated said:
Ok
I only have One Field with Dates in it. I want to be able to click on the
command button and be offered a start date dialogue box and then a end date
dialogue box the dates i type in are is the range i want to show all records
for that are within the dates entered. I know in query "Between [Start Date]
and [End Date]" will work but i was hoping to do this in a form

Klatuu said:
Your question is a bit vague to answer in detail, but to create an event
procedure for a command button, you open the properties dialog box for the
button, select the Events tab and click the small command button with the 3
dots on it just to the right of the On Click event text box. Then select Code
Builder from the popup menu.

The VB Editor will open with the cursor positioned in the sub for the event.

Now, you have to create the code you need to return the data. If you are
going to search for data within a range of dates, you will need two text
boxes on your form for the Start and End dates. What you do next depends on
where the data is you want to retrieve and what you want to do with it.

If you can provide a bit more detail, perhaps we can explain how to get what
you want.
--
Dave Hargis, Microsoft Access MVP


:

Hi if you can help i have a Form on our Club Database Access 2002 i want to
be able to create an [Event Procedure] on the form that will allow me to
search a Field Name "DateofRenewal" for all data between two dates and
possibly attache this Event to a button?
 

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