Results 1 to 6 of 6
  1. #1
    hinsdale1 is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Apr 2013
    Posts
    63

    Display images in a calendar report?

    I am developing a wardrobe database and would like to generate simple reports of prior months outfit usage in calendar form. Standard blank calendar form with the appropriate days of the week structure for the particular month as the column headers and with each box filled with only the date and a picture of the outfit worn.



    It is obviously a simple task to generate a query to produce the datesworn and the image of the outfit worn for the time perioud.. but am looking for approaches to automate generation of the report to fill a calendar.


    I am not terribly good at all this so am hoping for some help in how I might approach something like this. All thoughts, suggestions are welcomed and most appreciated.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,943
    I have seen Access databases dedicated to the generation of calendars. It's not simple because requires a reconfiguration of data that is not a conventional structure. Takes a lot of VBA. Suggest a search of forum and Google. Might hit a good example.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    amrut is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2012
    Location
    Dubai
    Posts
    614
    As suggested by June, lot of VBA is required. I have successfully tried a similar report. I required some data to be displayed besides the date in a calender style report.
    Here is the process -
    -Created a grid of unbound textboxes for date and listboxes to show required data.(6 rows X 7 Columns)
    -In the command button's code (which is used to open the report), opened the report in Report view
    -Looped through the listboxes of report and assigned appropriate SQL as row source.
    -In the report's load event, assign the dates to the unbound text boxes
    -hide the text boxes not required
    You can use image controls instead of list boxes.

  4. #4
    hinsdale1 is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Apr 2013
    Posts
    63
    Thanks for the replies.

    Amrut, your process sounds like what I am going to have to accomplish and I appreciate your taking the time to point me in the right direction.

    If you have a chance to post some of your loop code, or a few snippets of other relevant subs it would always be helpful... I am still getting my feet wet so always great to be looking at some known working bits of code.

    thanks again.

  5. #5
    amrut is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2012
    Location
    Dubai
    Posts
    614
    Code:
    'this is the button's code opening report
    
    Dim FirstDay As Integer
    Dim DayIndex As Integer
    Dim TextBoxIndex As Integer
    Dim Done As Boolean
    Dim ctlCalendar As control
    Dim strNum, strSQL, upSQL As String
    
    FirstDay = Weekday(DateSerial(Me.cmbYr, Me.cmbMth, 1)) ' Find out the first day of the week
        DayIndex = 1   ' Start counting days at 1
        TextBoxIndex = FirstDay   
        Done = False
        DoCmd.OpenReport "CalenderSchedule", acViewReport
           While Not (Done)
            
            strNum = right("00" & TextBoxIndex, 2)
    
            Set ctlCalendar = Reports("CalenderSchedule").Controls("List" & strNum) 
    
           strSQL = "SELECT Contracts.QuarryName FROM Contracts INNER JOIN workDetails ON Contracts.ContractID = workDetails.QName" _
            & " WHERE Day([workDate])=" & DayIndex & " AND Month([workDate])=" & Me.cmbMth & " AND Year([workDate])=" & Me.cmbYr & ";"
    
            Reports("CalenderSchedule").Controls("List" & strNum).RowSource = strSQL
            DayIndex = DayIndex + 1
            TextBoxIndex = TextBoxIndex + 1
        
            ' Are we done?  Check to see if we have indexed into next month
            If (Month(DateSerial(Forms!Schedule!cmbYr, Forms!Schedule!cmbMth, 1) + (DayIndex - 1)) <> Month(DateSerial(Forms!Schedule!cmbYr, Forms!Schedule!cmbMth, 1))) Then
               Done = True
            End If
        
        Wend
        
        
        Set ctlCalendar = Nothing
    *************************************************************************
    'This is the loop in report's load event. 
        FirstDay = Weekday(DateSerial(Forms!BlastSchedule!cmbYr, Forms!BlastSchedule!cmbMth, 1))  ' Figure out the first day of the week
        DayIndex = 1   ' Start counting days at 1
        TextBoxIndex = FirstDay   ' Start indexing text boxes at first day in month
        Done = False
        
     While Not (Done)
            ' Set the value of the correct date text box
            
            ' Make a 2-digit string with the number, e.g. "01" or "08" or "12" etc.
            strNum = right("00" & TextBoxIndex, 2)
            
            Set ctlCalendar = Me("WDay" & strNum) 
            ctlCalendar.Value = DayIndex          ' add dates to text boxes
                          
            DayIndex = DayIndex + 1
            TextBoxIndex = TextBoxIndex + 1
        
            ' Are we done?  Check to see if we have indexed into next month
            If (Month(DateSerial(Forms!Schedule!cmbYr, Forms!Schedule!cmbMth, 1) + (DayIndex - 1)) <> Month(DateSerial(Forms!Schedule!cmbYr, Forms!Schedule!cmbMth, 1))) Then
               Done = True
            End If
        
        Wend
        
        Set ctlCalendar = Nothing
        For Each ctl In Me.Controls
            If ctl.ControlType = acTextBox Then
                If IsNull(ctl) = True Then
                ctl.Visible = False                                'hide the text boxes not required
                Me("List" & right(ctl.Name, 2)).Visible = False             'hide the list boxes not required
                End If
            End If
        Next ctl
    I tried to combine the above loops but text box value could not be assigned in report's load event.
    Click image for larger version. 

Name:	Calender_Report.png 
Views:	12 
Size:	16.6 KB 
ID:	12053
    This is snapshot of part of report in design view. The bold font is for text boxes displaying date and other the list box.The textboxes are numbered as WDay01 to WDay42 and list boxes from List01 to List42.

  6. #6
    hinsdale1 is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Apr 2013
    Posts
    63
    Brilliant! Will save me lots of time seeing what you have done.. so kind of you to post. I am most grateful.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Display URL hyperlink images in form
    By cwillwright in forum Forms
    Replies: 1
    Last Post: 10-11-2012, 08:55 PM
  2. images won't display
    By merlin777 in forum Access
    Replies: 6
    Last Post: 09-02-2011, 09:02 AM
  3. Display Report as a Calendar Help
    By jice89 in forum Reports
    Replies: 1
    Last Post: 05-16-2011, 06:20 PM
  4. Display images in reports
    By pmregan in forum Reports
    Replies: 4
    Last Post: 07-20-2010, 02:49 PM
  5. Replies: 17
    Last Post: 08-26-2009, 11:27 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums