Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    saylindara is offline Novice
    Windows Vista Access 2003
    Join Date
    Jul 2009
    Posts
    16

    Calendar problem for British user


    I have added calendars to my reports to select date ranges because it was supposed to be a way of solving the USA/British date problem (so the Access tip said). Unfortunately the dates I select on the calendar give me USA results on the report. Deep despair. Is there anything I can do about this? Please bear in mind that I'm new to Access and a simpleton. I've read Allen Browne's international dates advice but I'm not sure what goes where.

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Why not show us what code you have created and maybe we'll be able to offer some suggestions.

  3. #3
    saylindara is offline Novice
    Windows Vista Access 2003
    Join Date
    Jul 2009
    Posts
    16
    On the unboun form there is a FromDate combobox , a ToDate combobox, a FindName combobox and a command button to open the report. They date boxes are comboboxes rather than text boxes so people know they have to click on them.

    The MouseDown Event on cboFromDate (and similar for cboToDate) is:

    Ocx.Calendar.Visible = True
    ocxCalendar.SetFocus
    If Not IsNull (cboFromDate) Then
    ocxCalendar.Value = cboFromDate (the instructions said this should be cboFromDate.Value but it didn’t work like this)
    Else
    ocxCalendar.Value = Date
    End If

    The Calendar:

    The Visible property is set to No.
    The Click Event:
    cboFromDate = ocxCalendar.Value
    cboFromDate.Set Focus
    ocxCalendar.Visible = False

    The command button Click Event:

    Refresh
    If IsNull (cboFindName) Then
    DoCmd.OpenReport “r_EventsAttended”, acViewPreview,, & “ AND “ & “EventDate >= #” & Me.cboFromDate & “ # AND “ & “EventDate <= #” & Me.cboToDate & “#”
    Else
    DoCmd.OpenReport “r_EventsAttended”, acViewPreview,, “EmployeeID = “ & Me.cboFindName & “AND” & “EventDate >= #” & Me.cboFromDate & “ # AND “ & “EventDate <= #” & Me.cboToDate & “#”
    End If

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    You should really Copy and Paste any code so we don't have to wade through the typo's. Maybe you want to use this Microsoft function on your [EventDate] field in the query.

  5. #5
    saylindara is offline Novice
    Windows Vista Access 2003
    Join Date
    Jul 2009
    Posts
    16
    Thank you for your reply.

    I created a new module as below:

    Function MakeUSDate(x As Variant)
    If Not IsDate(x) Then Exit Function
    MakeUSDate = "#" & Month(x) & "/" & Day(x) & "/" & Year(x) & "#"
    End Function

    It results in the date being shown as #mm/dd/yyy#. Unfortunately all I get then is a blank report using the following command click event.

    Private Sub Command4_Click()
    Refresh
    If IsNull(cboFindName) Then
    DoCmd.OpenReport "r_EventsAttended", acViewPreview, , "USEventDate >= #" & Me.cboFromDate.Value & " # AND " & "USEventDate <= #" & Me.cboToDate.Value & "#"
    Else
    DoCmd.OpenReport "r_EventsAttended", acViewPreview, , "EmployeeID = " & Me.cboFindName & " AND " & "USEventDate >= #" & Me.cboFromDate.Value & " # AND " & "USEventDate <= #" & Me.cboToDate.Value & "#"
    End If
    End Sub

    I suppose using this method the USEventDate field could never match the combobox date. Any further help would be appreciated.

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Where did you use the new function?

  7. #7
    saylindara is offline Novice
    Windows Vista Access 2003
    Join Date
    Jul 2009
    Posts
    16
    I used it in the report query

  8. #8
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Could you post the SQL for the report query please?

  9. #9
    saylindara is offline Novice
    Windows Vista Access 2003
    Join Date
    Jul 2009
    Posts
    16
    I hope you can make sense of this amateur effort.

    SELECT DISTINCT t_EmployeeType.EmployeeType, t_Employees.EmployeeID, q_EmployeeEventLocation.Concat2, q_EmployeeEventLocation.EventDay, q_EventsAll.EventName, q_EmployeeEventLocation.EventDate, q_EmployeeEventLocation.LocationName, q_EventsAll.EventDurationDays, q_EmployeeEventLocation.DurationDepartment, q_EmployeeEventLocation.DurationOwnTime, IIf([DurationDepartment]=0,[EventDurationDays],[DurationDepartment]) AS ActualDuration, Format([EventDate],"mmmm") AS EventMonth, MakeUSDate([EventDate]) AS USEventDate
    FROM t_EmployeeType INNER JOIN (((q_EmployeeJobTitleTeam INNER JOIN (q_EmployeeEventLocation INNER JOIN q_EventsAll ON q_EmployeeEventLocation.EventID = q_EventsAll.EventID) ON q_EmployeeJobTitleTeam.Concat1 = q_EmployeeEventLocation.Concat1) INNER JOIN t_Team ON q_EmployeeJobTitleTeam.TeamID = t_Team.TeamID) INNER JOIN t_Employees ON q_EmployeeJobTitleTeam.EmployeeID = t_Employees.EmployeeID) ON t_EmployeeType.EmployeeTypeID = t_Employees.EmployeeTypeID
    WHERE (((t_EmployeeType.EmployeeType) Like "pod*"))
    ORDER BY q_EmployeeEventLocation.EventDate;

  10. #10
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Have you looked at the query in datasheet view to see what your dates look like?

  11. #11
    saylindara is offline Novice
    Windows Vista Access 2003
    Join Date
    Jul 2009
    Posts
    16
    The dates look the same in datasheet view, ie in the format #mm/dd/yyyy# including the hash marks.

  12. #12
    saylindara is offline Novice
    Windows Vista Access 2003
    Join Date
    Jul 2009
    Posts
    16
    I take it that as I have received no further responses that no one on this forum can assist me further. I would like to thank Rural Guy for his kind help. I am much further forward than I was before.

  13. #13
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I haven't given up yet, I just could not think of another suggestion. I wonder if it has something to do with Vista?

  14. #14
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I've heard that using the Format() function with a "Short Date" works.

  15. #15
    saylindara is offline Novice
    Windows Vista Access 2003
    Join Date
    Jul 2009
    Posts
    16
    I'll try Format() at work tomorrow where I'm using Access 2003 but it didn't work on the copy of the database I've got at home on Vista. I also tried using that with long date but that didn't work either. It may well be I suppose that the amateurish, makeshift and mend way I set up the database (my one and only) is a contributory factor.

    I'm sure if you don't know then neither does anyone else but if I don't have any luck tomorrow I'll try posting on another forum just in case.

    Thanks again for your kind and patient help.

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Event Calendar Help
    By Nosaj08 in forum Forms
    Replies: 9
    Last Post: 06-11-2010, 11:19 AM
  2. create calendar form
    By nwalke in forum Forms
    Replies: 0
    Last Post: 06-30-2009, 10:35 AM
  3. Access Calendar Control
    By JGG in forum Access
    Replies: 7
    Last Post: 04-03-2009, 04:34 AM
  4. Problem with Read Only User
    By admaldo in forum Security
    Replies: 0
    Last Post: 04-24-2006, 11:51 AM
  5. Calendar Mystery
    By BankWalker in forum Forms
    Replies: 0
    Last Post: 02-16-2006, 01:29 PM

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