Help!

Restrict with equal on German computers


Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> Programming VBA RSS
Next:  Outlook form - data in fields not being sent  
Author Message
Peter Marchert
External


Since: Jun 05, 2007
Posts: 8



PostPosted: Thu Aug 02, 2007 12:39 am    Post subject: Restrict with equal on German computers
Archived from groups: microsoft>public>outlook>program_vba (more info?)

Hello,

I have a restrict problem on german computers only.

The following code works fine on an english system:

Sub Test1()

Dim objCalendar As Outlook.MAPIFolder
Dim objAppis As Outlook.Items
Dim strFilter As String

Set objCalendar =
Outlook.Session.GetDefaultFolder(olFolderCalendar)

strFilter = "[Start] = '" & Format("8/25/07", "ddddd h:nn AMPM") &
"'"

Set objAppis = objCalendar.Items.Restrict(strFilter)

Debug.Print objAppis.Count

End Sub

All items with the specified start date are returned. The same code on
a german system returns no items ("objAppis.Count" is always zero).

This code:

Sub Test2()

Dim objCalendar As Outlook.MAPIFolder
Dim objAppis As Outlook.Items
Dim strFilter As String

Set objCalendar =
Outlook.Session.GetDefaultFolder(olFolderCalendar)

strFilter = "[Start] > '" & Format("8/24/07", "ddddd h:nn AMPM") &
"'" & _
"AND [Start] < '" & Format("8/26/07", "ddddd h:nn AMPM") & "'"

Set objAppis = objCalendar.Items.Restrict(strFilter)

Debug.Print objAppis.Count

End Sub

returns all items between 8/25/07 and 8/26/07. So I`m afraid this is a
bug in Outlook or only a date formatting problem.

Thanks in advanced for any help!

Peter

--
Infos, workshops & soft-
ware for your Outlook®:
www.outlook-stuff.com
Back to top
Ken Slovak - [MVP - Outlo
External


Since: Oct 17, 2003
Posts: 3213



PostPosted: Thu Aug 02, 2007 9:02 am    Post subject: Re: Restrict with equal on German computers [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

I'd guess it's the date format, but I don't have a German system here to
test on. I'd try using the format string for long date using your system
settings or maybe General Date format. Empirically I'd just use the VBA
project to set up a filter string that works (hard-coded) and then replicate
that date format with the Format function.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Peter Marchert" <mpnews2.DeleteThis@arcor.de> wrote in message
news:1186040396.268863.198050@22g2000hsm.googlegroups.com...
Hello,

I have a restrict problem on german computers only.

The following code works fine on an english system:

Sub Test1()

Dim objCalendar As Outlook.MAPIFolder
Dim objAppis As Outlook.Items
Dim strFilter As String

Set objCalendar =
Outlook.Session.GetDefaultFolder(olFolderCalendar)

strFilter = "[Start] = '" & Format("8/25/07", "ddddd h:nn AMPM") &
"'"

Set objAppis = objCalendar.Items.Restrict(strFilter)

Debug.Print objAppis.Count

End Sub

All items with the specified start date are returned. The same code on
a german system returns no items ("objAppis.Count" is always zero).

This code:

Sub Test2()

Dim objCalendar As Outlook.MAPIFolder
Dim objAppis As Outlook.Items
Dim strFilter As String

Set objCalendar =
Outlook.Session.GetDefaultFolder(olFolderCalendar)

strFilter = "[Start] > '" & Format("8/24/07", "ddddd h:nn AMPM") &
"'" & _
"AND [Start] < '" & Format("8/26/07", "ddddd h:nn AMPM") & "'"

Set objAppis = objCalendar.Items.Restrict(strFilter)

Debug.Print objAppis.Count

End Sub

returns all items between 8/25/07 and 8/26/07. So I`m afraid this is a
bug in Outlook or only a date formatting problem.

Thanks in advanced for any help!

Peter

--
Infos, workshops & soft-
ware for your Outlook®:
www.outlook-stuff.com
Back to top
Sue Mosher [MVP-Outlook]
External


Since: Feb 11, 2005
Posts: 21627



PostPosted: Thu Aug 02, 2007 9:58 am    Post subject: Re: Restrict with equal on German computers [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Another idea: The problem may be that Find and Restrict use localized names for the fields, but there is no source of documentation for those names. I would replace Start with whatever Outlook shows as the column heading in the table view that includes the start field.
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"Peter Marchert" <mpnews2.TakeThisOut@arcor.de> wrote in message news:1186040396.268863.198050@22g2000hsm.googlegroups.com...
Hello,

I have a restrict problem on german computers only.

The following code works fine on an english system:

Sub Test1()

Dim objCalendar As Outlook.MAPIFolder
Dim objAppis As Outlook.Items
Dim strFilter As String

Set objCalendar =
Outlook.Session.GetDefaultFolder(olFolderCalendar)

strFilter = "[Start] = '" & Format("8/25/07", "ddddd h:nn AMPM") &
"'"

Set objAppis = objCalendar.Items.Restrict(strFilter)

Debug.Print objAppis.Count

End Sub

All items with the specified start date are returned. The same code on
a german system returns no items ("objAppis.Count" is always zero).

This code:

Sub Test2()

Dim objCalendar As Outlook.MAPIFolder
Dim objAppis As Outlook.Items
Dim strFilter As String

Set objCalendar =
Outlook.Session.GetDefaultFolder(olFolderCalendar)

strFilter = "[Start] > '" & Format("8/24/07", "ddddd h:nn AMPM") &
"'" & _
"AND [Start] < '" & Format("8/26/07", "ddddd h:nn AMPM") & "'"

Set objAppis = objCalendar.Items.Restrict(strFilter)

Debug.Print objAppis.Count

End Sub

returns all items between 8/25/07 and 8/26/07. So I`m afraid this is a
bug in Outlook or only a date formatting problem.

Thanks in advanced for any help!

Peter

--
Infos, workshops & soft-
ware for your Outlook®:
www.outlook-stuff.com
Back to top
Peter Marchert
External


Since: Jun 05, 2007
Posts: 8



PostPosted: Fri Aug 03, 2007 12:36 am    Post subject: Re: Restrict with equal on German computers [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Thanks Sue for this idea. Really the code woks with the local field
"Beginn" instead of "Start" but returns the same result.

Peter

--
Infos, workshops & soft-
ware for your Outlook®:
www.outlook-stuff.com


On 2 Aug., 15:58, "Sue Mosher [MVP-Outlook]" <sue....TakeThisOut@outlookcode.com>
wrote:
> Another idea: The problem may be that Find and Restrict use localized names for the fields, but there is no source of documentation for those names. I would replace Start with whatever Outlook shows as the column heading in the table view that includes the start field.
> --
> Sue Mosher, Outlook MVP
> Author of Microsoft Outlook 2007 Programming:
> Jumpstart for Power Users and Administrators
> http://www.outlookcode.com/article.aspx?id=54
>
> "Peter Marchert" <mpne....TakeThisOut@arcor.de> wrote in messagenews:1186040396.268863.198050@22g2000hsm.googlegroups.com...
>
> Hello,
>
> I have a restrict problem on german computers only.
>
> The following code works fine on an english system:
>
> Sub Test1()
>
> Dim objCalendar As Outlook.MAPIFolder
> Dim objAppis As Outlook.Items
> Dim strFilter As String
>
> Set objCalendar =
> Outlook.Session.GetDefaultFolder(olFolderCalendar)
>
> strFilter = "[Start] = '" & Format("8/25/07", "ddddd h:nn AMPM") &
> "'"
>
> Set objAppis = objCalendar.Items.Restrict(strFilter)
>
> Debug.Print objAppis.Count
>
> End Sub
>
> All items with the specified start date are returned. The same code on
> a german system returns no items ("objAppis.Count" is always zero).
>
> This code:
>
> Sub Test2()
>
> Dim objCalendar As Outlook.MAPIFolder
> Dim objAppis As Outlook.Items
> Dim strFilter As String
>
> Set objCalendar =
> Outlook.Session.GetDefaultFolder(olFolderCalendar)
>
> strFilter = "[Start] > '" & Format("8/24/07", "ddddd h:nn AMPM") &
> "'" & _
> "AND [Start] < '" & Format("8/26/07", "ddddd h:nn AMPM") & "'"
>
> Set objAppis = objCalendar.Items.Restrict(strFilter)
>
> Debug.Print objAppis.Count
>
> End Sub
>
> returns all items between 8/25/07 and 8/26/07. So I`m afraid this is a
> bug in Outlook or only a date formatting problem.
>
> Thanks in advanced for any help!
>
> Peter
>
> --
> Infos, workshops & soft-
> ware for your Outlook®:www.outlook-stuff.com
Back to top
Peter Marchert
External


Since: Jun 05, 2007
Posts: 8



PostPosted: Fri Aug 03, 2007 12:38 am    Post subject: Re: Restrict with equal on German computers [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Thanks for your answer, Ken.

I tried several formats and it works with the following:
Format("8/25/07", "ddddd h:nn")

I guess because German people does not have AM/PM Smile

Peter

--
Infos, workshops & soft-
ware for your Outlook®:
www.outlook-stuff.com


On 2 Aug., 15:02, "Ken Slovak - [MVP - Outlook]" <kenslo... DeleteThis @mvps.org>
wrote:
> I'd guess it's the date format, but I don't have a German system here to
> test on. I'd try using the format string for long date using your system
> settings or maybe General Date format. Empirically I'd just use the VBA
> project to set up a filter string that works (hard-coded) and then replicate
> that date format with the Format function.
>
> --
> Ken Slovak
> [MVP - Outlook]http://www.slovaktech.com
> Author: Professional Programming Outlook 2007
> Reminder Manager, Extended Reminders, Attachment Optionshttp://www.slovaktech.com/products.htm
>
> "Peter Marchert" <mpne... DeleteThis @arcor.de> wrote in message
>
> news:1186040396.268863.198050@22g2000hsm.googlegroups.com...
> Hello,
>
> I have a restrict problem on german computers only.
>
> The following code works fine on an english system:
>
> Sub Test1()
>
> Dim objCalendar As Outlook.MAPIFolder
> Dim objAppis As Outlook.Items
> Dim strFilter As String
>
> Set objCalendar =
> Outlook.Session.GetDefaultFolder(olFolderCalendar)
>
> strFilter = "[Start] = '" & Format("8/25/07", "ddddd h:nn AMPM") &
> "'"
>
> Set objAppis = objCalendar.Items.Restrict(strFilter)
>
> Debug.Print objAppis.Count
>
> End Sub
>
> All items with the specified start date are returned. The same code on
> a german system returns no items ("objAppis.Count" is always zero).
>
> This code:
>
> Sub Test2()
>
> Dim objCalendar As Outlook.MAPIFolder
> Dim objAppis As Outlook.Items
> Dim strFilter As String
>
> Set objCalendar =
> Outlook.Session.GetDefaultFolder(olFolderCalendar)
>
> strFilter = "[Start] > '" & Format("8/24/07", "ddddd h:nn AMPM") &
> "'" & _
> "AND [Start] < '" & Format("8/26/07", "ddddd h:nn AMPM") & "'"
>
> Set objAppis = objCalendar.Items.Restrict(strFilter)
>
> Debug.Print objAppis.Count
>
> End Sub
>
> returns all items between 8/25/07 and 8/26/07. So I`m afraid this is a
> bug in Outlook or only a date formatting problem.
>
> Thanks in advanced for any help!
>
> Peter
>
> --
> Infos, workshops & soft-
> ware for your Outlook®:www.outlook-stuff.com
Back to top
Display posts from previous:   
Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> Programming VBA All times are: Eastern Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum