Open a form to view a specific record in a different form according to the date

dtechpcs

New member
Local time
Today, 13:38
Joined
Apr 28, 2009
Messages
4
Hello all and thanks in advance if you can help me out with this one.

I'm really in need of some assistance with a problem I've been up against for some time now.

I'm creating an Access 2007 database for scheduling appointments and need to display the data in a daily view form, I would like it to look and feel very much like a regular diary/calendar application for ease of navigation to the user.

I have a form with 31 control buttons representing each day of the month which I need to, when clicked on, open another form which contains the data according to that particular day, if that makes sense.

I also need the form which is being opened to remain without a filter so users can scroll through the records to the previous or next days data, and make amendments as required, similarly as you would do on a windows or outlook calendar.

If possible I would like to add the code to the On Click event of each button, and have each button open a different day of the month. I'd then apply that same method to separate forms for every month of the year.

I have searched for weeks trying to get an idea of the correct code I need to use and even though there are several threads about opening forms to specific records, none of them work the way I need it to.

The forms names are as follows if this helps

"january_2010" = default form displayed when Access open
"daily_view" = displays data for each day of the month

and "todays_date" is the name of the text box which contains the date on the daily_view form.

I'm very much still learning the basics here and not sure if it can even be done this way so any assistance at all would be very much appreciated.

Thanks again in advance.
 
what you will han tto do it open the form and then fin the date, not filter to the data.


Here is how I do it with a contacts/people form:

This is in the command button of a search form to open the Contacts form and then find the desired record. This will allow the user to then scroll through all the records is desired..

Code:
Private Sub cmdViewCustomer_Click()
On Error GoTo Err_cmdViewCustomer_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "Contacts"

' this is the code thatwould filter the form    
'    stLinkCriteria = "[Customer Number]=" & "'" & Me![Customer Number] & "'"
'    DoCmd.OpenForm stDocName, , , stLinkCriteria


' now open the form with a filter to get all records
    DoCmd.OpenForm stDocName

  ' find the desired record and mkae it the current record
  
    DoCmd.SelectObject acForm, "Contacts"
    DoCmd.GoToControl "ContactsKey"
    DoCmd.FindRecord Me.ContactsKey, A_ENTIRE, False, acSearchAll, False, A_CURRENT
    DoCmd.SelectObject acForm, "Contacts"
    DoCmd.GoToControl "ContactsKey"


Exit_cmdViewCustomer_Click:
    Exit Sub

Err_cmdViewCustomer_Click:
    MsgBox Err.Description
    Resume Exit_cmdViewCustomer_Click
    
End Sub
 
Thanks for the quick response HiTechCoach,

Yes I need to open the form named daily_view by clicking on either of the buttons on the form named january_2010, once opened I would like the data to be displayed according to which button I pressed. So if button 6 (representing the 6th day of the month) was pressed, the daily_view form would open at record number 6 or in other words 06/01/2010 would be displayed in the text box named todays_date on the daily_view form.

I've added your code to the OnClick event of one of the buttons on my form (january_2010) and changed what I think needs to be changed but it still doesn't work as I hoped it would. I may have made a mistake somewhere as I dont have a great deal of experience when it comes to writing code and am unsure about what certain parts mean, in particular stLinkCriteria.

I'll alter the code a little more and do some reading about stLinkCriteria to see if I can figure it out.

Anything else you or anyone can add to help me get the results I'm looking for would be gratefully appreciated.

Thanks again for the assistance.
 

Users who are viewing this thread

Back
Top Bottom