>> binding...

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi, I'm updating public folder contacts from MS Access. When I have a
reference to the Outlook Object Library the routine does its thing. However
I'm using Outlook 12 and the other users have Outlook 11. So I want to remove
the reference to the Outlook Object Library and declare variables as
[generic] objects instead of outlook.objects. Unfortunitely it now fails...

The following is the code snippet (contained within a loop of a recordset)
with the problem. Background is I have a table that maps outlook contact
fields to database fields. The code retreives (strOlField) the appropriate
outlook contact field for data insertion.

'Insert an outlook for each database contact
Set myContact = myContactItems.Add(olContactItem)
For Each fld In .Fields
If Not IsNull(fld.Value) Then
strOlField = getOutlookField(fld.Name, strColumn)
If Len(strOlField) > 0 Then
myContact.ItemProperties(strOlField) = fld.Value
End If
End If
DoEvents
Next fld

The line

myContact.ItemProperties(strOlField) = fld.Value

generates "Error 450 (Wrong number of arguments or invalid property
assignment)..."

This error does not occur when using early binding.

Any ideas or suggestion appreciated :-)

Many thanks, Jonathan
 
Does this work any better in the late bound code:

myContact.ItemProperties.Item(strOlField) = fld.Value
 
Ken Slovak - said:
Does this work any better in the late bound code:

myContact.ItemProperties.Item(strOlField) = fld.Value

Thanks for the idea. <sigh>Unfortunitly it still generates the same
error</sigh> .

Many thanks
Jonathan
Jonathan said:
Hi, I'm updating public folder contacts from MS Access. When I have a
reference to the Outlook Object Library the routine does its thing.
However
I'm using Outlook 12 and the other users have Outlook 11. So I want to
remove
the reference to the Outlook Object Library and declare variables as
[generic] objects instead of outlook.objects. Unfortunitely it now
fails...

The following is the code snippet (contained within a loop of a recordset)
with the problem. Background is I have a table that maps outlook contact
fields to database fields. The code retreives (strOlField) the appropriate
outlook contact field for data insertion.

'Insert an outlook for each database contact
Set myContact = myContactItems.Add(olContactItem)
For Each fld In .Fields
If Not IsNull(fld.Value) Then
strOlField = getOutlookField(fld.Name, strColumn)
If Len(strOlField) > 0 Then
myContact.ItemProperties(strOlField) = fld.Value
End If
End If
DoEvents
Next fld

The line

myContact.ItemProperties(strOlField) = fld.Value

generates "Error 450 (Wrong number of arguments or invalid property
assignment)..."

This error does not occur when using early binding.

Any ideas or suggestion appreciated :-)

Many thanks, Jonathan
 
Do you have olContactItem declared somewhere as a constant? If not, that could be the problem -- the item you're creating will be a MailItem, not a ContactItem because olContactItem will equal zero. (Option Explicit does wonders for rooting out these little problems.)
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


Jonathan said:
Ken Slovak - said:
Does this work any better in the late bound code:

myContact.ItemProperties.Item(strOlField) = fld.Value

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm

Thanks for the idea. <sigh>Unfortunitly it still generates the same
error</sigh> .

Many thanks
Jonathan
Jonathan said:
Hi, I'm updating public folder contacts from MS Access. When I have a
reference to the Outlook Object Library the routine does its thing.
However
I'm using Outlook 12 and the other users have Outlook 11. So I want to
remove
the reference to the Outlook Object Library and declare variables as
[generic] objects instead of outlook.objects. Unfortunitely it now
fails...

The following is the code snippet (contained within a loop of a recordset)
with the problem. Background is I have a table that maps outlook contact
fields to database fields. The code retreives (strOlField) the appropriate
outlook contact field for data insertion.

'Insert an outlook for each database contact
Set myContact = myContactItems.Add(olContactItem)
For Each fld In .Fields
If Not IsNull(fld.Value) Then
strOlField = getOutlookField(fld.Name, strColumn)
If Len(strOlField) > 0 Then
myContact.ItemProperties(strOlField) = fld.Value
End If
End If
DoEvents
Next fld

The line

myContact.ItemProperties(strOlField) = fld.Value

generates "Error 450 (Wrong number of arguments or invalid property
assignment)..."

This error does not occur when using early binding.

Any ideas or suggestion appreciated :-)

Many thanks, Jonathan
 
Sue Mosher said:
Do you have olContactItem declared somewhere as a constant? If not, that could be the problem -- the item you're creating will be a MailItem, not a ContactItem because olContactItem will equal zero. (Option Explicit does wonders for rooting out these little problems.)
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


Thanks Sue, yes I have all my Outlook constants declared in General
Declarations section. I really do appologise for not including this in the
background info of my questions.

Private Const olContactItem = 2


Many thanks,
Jonathan
Jonathan said:
Ken Slovak - said:
Does this work any better in the late bound code:

myContact.ItemProperties.Item(strOlField) = fld.Value

Thanks for the idea. <sigh>Unfortunitly it still generates the same
error</sigh> .

Many thanks
Jonathan
Hi, I'm updating public folder contacts from MS Access. When I have a
reference to the Outlook Object Library the routine does its thing.
However
I'm using Outlook 12 and the other users have Outlook 11. So I want to
remove
the reference to the Outlook Object Library and declare variables as
[generic] objects instead of outlook.objects. Unfortunitely it now
fails...

The following is the code snippet (contained within a loop of a recordset)
with the problem. Background is I have a table that maps outlook contact
fields to database fields. The code retreives (strOlField) the appropriate
outlook contact field for data insertion.

'Insert an outlook for each database contact
Set myContact = myContactItems.Add(olContactItem)
For Each fld In .Fields
If Not IsNull(fld.Value) Then
strOlField = getOutlookField(fld.Name, strColumn)
If Len(strOlField) > 0 Then
myContact.ItemProperties(strOlField) = fld.Value
End If
End If
DoEvents
Next fld

The line

myContact.ItemProperties(strOlField) = fld.Value

generates "Error 450 (Wrong number of arguments or invalid property
assignment)..."

This error does not occur when using early binding.

Any ideas or suggestion appreciated :-)

Many thanks, Jonathan
 
Is it possible that it doesn't happen with every recordset, and early-/late
binding doesn't really matter? One source for such an error would be that
fld.Value is an object. In that case the Set statement is misssing:

Set myContact.ItemProperties.Item(strOlField).Value = fld.value

Additionally, I'd recommend to always write the property name.
Item(strOlField) is an object, but actually you don't want to set that
object but write something into its Value property. If fld.value is an
object then VB can't know that you actually want to access the Item's
default property, and this would be twice an error:

myContact.ItemProperties.Item(strOlField) = fld.value

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Organize eMails:
<http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6>

Am Wed, 11 Jul 2007 17:26:02 -0700 schrieb Jonathan:
could be the problem -- the item you're creating will be a MailItem, not a
ContactItem because olContactItem will equal zero. (Option Explicit does
wonders for rooting out these little problems.)
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


Thanks Sue, yes I have all my Outlook constants declared in General
Declarations section. I really do appologise for not including this in the
background info of my questions.

Private Const olContactItem = 2


Many thanks,
Jonathan
:

Does this work any better in the late bound code:

myContact.ItemProperties.Item(strOlField) = fld.Value



Thanks for the idea. <sigh>Unfortunitly it still generates the same
error</sigh> .

Many thanks
Jonathan


Hi, I'm updating public folder contacts from MS Access. When I have a
reference to the Outlook Object Library the routine does its thing.
However
I'm using Outlook 12 and the other users have Outlook 11. So I want to
remove
the reference to the Outlook Object Library and declare variables as
[generic] objects instead of outlook.objects. Unfortunitely it now
fails...

The following is the code snippet (contained within a loop of a recordset)
with the problem. Background is I have a table that maps outlook contact
fields to database fields. The code retreives (strOlField) the appropriate
outlook contact field for data insertion.

'Insert an outlook for each database contact
Set myContact = myContactItems.Add(olContactItem)
For Each fld In .Fields
If Not IsNull(fld.Value) Then
strOlField = getOutlookField(fld.Name, strColumn)
If Len(strOlField) > 0 Then
myContact.ItemProperties(strOlField) = fld.Value
End If
End If
DoEvents
Next fld

The line

myContact.ItemProperties(strOlField) = fld.Value

generates "Error 450 (Wrong number of arguments or invalid property
assignment)..."

This error does not occur when using early binding.

Any ideas or suggestion appreciated :-)

Many thanks, Jonathan
 
Michael Bauer said:
Is it possible that it doesn't happen with every recordset, and early-/late
binding doesn't really matter? One source for such an error would be that
fld.Value is an object. In that case the Set statement is misssing:

Set myContact.ItemProperties.Item(strOlField).Value = fld.value

Additionally, I'd recommend to always write the property name.
Item(strOlField) is an object, but actually you don't want to set that
object but write something into its Value property. If fld.value is an
object then VB can't know that you actually want to access the Item's
default property, and this would be twice an error:

myContact.ItemProperties.Item(strOlField) = fld.value

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Organize eMails:
<http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6>


Thanks Michael for this. fld.Value is definitely a value. This routine works
with the same recordset when object variables are declared as Outlook
objects. When object variables are set to simple objects this routine fails.
I sure that there is a logical reason for it... I just can't recognise it...

Many thanks, Jonathan

Am Wed, 11 Jul 2007 17:26:02 -0700 schrieb Jonathan: could be the problem -- the item you're creating will be a MailItem, not a
ContactItem because olContactItem will equal zero. (Option Explicit does
wonders for rooting out these little problems.)
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


Thanks Sue, yes I have all my Outlook constants declared in General
Declarations section. I really do appologise for not including this in the
background info of my questions.

Private Const olContactItem = 2


Many thanks,
Jonathan
:

Does this work any better in the late bound code:

myContact.ItemProperties.Item(strOlField) = fld.Value



Thanks for the idea. <sigh>Unfortunitly it still generates the same
error</sigh> .

Many thanks
Jonathan


Hi, I'm updating public folder contacts from MS Access. When I have a
reference to the Outlook Object Library the routine does its thing.
However
I'm using Outlook 12 and the other users have Outlook 11. So I want to
remove
the reference to the Outlook Object Library and declare variables as
[generic] objects instead of outlook.objects. Unfortunitely it now
fails...

The following is the code snippet (contained within a loop of a recordset)
with the problem. Background is I have a table that maps outlook contact
fields to database fields. The code retreives (strOlField) the appropriate
outlook contact field for data insertion.

'Insert an outlook for each database contact
Set myContact = myContactItems.Add(olContactItem)
For Each fld In .Fields
If Not IsNull(fld.Value) Then
strOlField = getOutlookField(fld.Name, strColumn)
If Len(strOlField) > 0 Then
myContact.ItemProperties(strOlField) = fld.Value
End If
End If
DoEvents
Next fld

The line

myContact.ItemProperties(strOlField) = fld.Value

generates "Error 450 (Wrong number of arguments or invalid property
assignment)..."

This error does not occur when using early binding.

Any ideas or suggestion appreciated :-)

Many thanks, Jonathan
 
Of course is fld.Value a Value :)

But that property is a Variant and may also reference an object. I don't
remember the name for that type of query but a specific sql query returns a
recordset within a recordset's Field object. That is, fld.Value would be an
object and not a string or whatever.

Do you test the late binding also with OL07 or with OL03?

This is what I'd do next:

- change the code - to know exactly what line causes the error:
Dim Props as Object
Dim Prop as Object
Set Props=myContact.ItemProperties
Set Prop=Props(strOlField)
Prop.Value=fld.Value

- add a Debug statement - just to be very sure...:
Debug.Print TypeName(fld.Value)
Prop.Value=fld.Value


--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Organize eMails:
<http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6>

Am Thu, 12 Jul 2007 14:04:03 -0700 schrieb Jonathan:
Thanks Michael for this. fld.Value is definitely a value. This routine works
with the same recordset when object variables are declared as Outlook
objects. When object variables are set to simple objects this routine fails.
I sure that there is a logical reason for it... I just can't recognise it...

Many thanks, Jonathan

Am Wed, 11 Jul 2007 17:26:02 -0700 schrieb Jonathan:
:

Do you have olContactItem declared somewhere as a constant? If not,
that
could be the problem -- the item you're creating will be a MailItem, not a
ContactItem because olContactItem will equal zero. (Option Explicit does
wonders for rooting out these little problems.)
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


Thanks Sue, yes I have all my Outlook constants declared in General
Declarations section. I really do appologise for not including this in the
background info of my questions.

Private Const olContactItem = 2


Many thanks,
Jonathan


:

Does this work any better in the late bound code:

myContact.ItemProperties.Item(strOlField) = fld.Value



Thanks for the idea. <sigh>Unfortunitly it still generates the same
error</sigh> .

Many thanks
Jonathan


Hi, I'm updating public folder contacts from MS Access. When I have a
reference to the Outlook Object Library the routine does its thing.
However
I'm using Outlook 12 and the other users have Outlook 11. So I want to
remove
the reference to the Outlook Object Library and declare variables as
[generic] objects instead of outlook.objects. Unfortunitely it now
fails...

The following is the code snippet (contained within a loop of a recordset)
with the problem. Background is I have a table that maps outlook contact
fields to database fields. The code retreives (strOlField) the appropriate
outlook contact field for data insertion.

'Insert an outlook for each database contact
Set myContact = myContactItems.Add(olContactItem)
For Each fld In .Fields
If Not IsNull(fld.Value) Then
strOlField = getOutlookField(fld.Name, strColumn)
If Len(strOlField) > 0 Then
myContact.ItemProperties(strOlField) = fld.Value
End If
End If
DoEvents
Next fld

The line

myContact.ItemProperties(strOlField) = fld.Value

generates "Error 450 (Wrong number of arguments or invalid property
assignment)..."

This error does not occur when using early binding.

Any ideas or suggestion appreciated :-)

Many thanks, Jonathan
 
Michael Bauer said:
Of course is fld.Value a Value :)

But that property is a Variant and may also reference an object. I don't
remember the name for that type of query but a specific sql query returns a
recordset within a recordset's Field object. That is, fld.Value would be an
object and not a string or whatever.

Do you test the late binding also with OL07 or with OL03?

This is what I'd do next:

- change the code - to know exactly what line causes the error:
Dim Props as Object
Dim Prop as Object
Set Props=myContact.ItemProperties
Set Prop=Props(strOlField)
Prop.Value=fld.Value

- add a Debug statement - just to be very sure...:
Debug.Print TypeName(fld.Value)
Prop.Value=fld.Value


--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Organize eMails:
<http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6>

Hi Michael,


Attempting this with Ol07 and Ol03. Same outcome.

Debug.Print fld.Value returns 1
Debug.Print TypeName(fld.Value) returns Long

Many thanks, Jonathan
Am Thu, 12 Jul 2007 14:04:03 -0700 schrieb Jonathan:
Thanks Michael for this. fld.Value is definitely a value. This routine works
with the same recordset when object variables are declared as Outlook
objects. When object variables are set to simple objects this routine fails.
I sure that there is a logical reason for it... I just can't recognise it...

Many thanks, Jonathan

Am Wed, 11 Jul 2007 17:26:02 -0700 schrieb Jonathan:
:

Do you have olContactItem declared somewhere as a constant? If not, that
could be the problem -- the item you're creating will be a MailItem, not a
ContactItem because olContactItem will equal zero. (Option Explicit does
wonders for rooting out these little problems.)
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


Thanks Sue, yes I have all my Outlook constants declared in General
Declarations section. I really do appologise for not including this in the
background info of my questions.

Private Const olContactItem = 2


Many thanks,
Jonathan


:

Does this work any better in the late bound code:

myContact.ItemProperties.Item(strOlField) = fld.Value



Thanks for the idea. <sigh>Unfortunitly it still generates the same
error</sigh> .

Many thanks
Jonathan


Hi, I'm updating public folder contacts from MS Access. When I have a
reference to the Outlook Object Library the routine does its thing.
However
I'm using Outlook 12 and the other users have Outlook 11. So I want
to
remove
the reference to the Outlook Object Library and declare variables as
[generic] objects instead of outlook.objects. Unfortunitely it now
fails...

The following is the code snippet (contained within a loop of a
recordset)
with the problem. Background is I have a table that maps outlook
contact
fields to database fields. The code retreives (strOlField) the
appropriate
outlook contact field for data insertion.

'Insert an outlook for each database contact
Set myContact = myContactItems.Add(olContactItem)
For Each fld In .Fields
If Not IsNull(fld.Value) Then
strOlField = getOutlookField(fld.Name, strColumn)
If Len(strOlField) > 0 Then
myContact.ItemProperties(strOlField) =
fld.Value
End If
End If
DoEvents
Next fld

The line

myContact.ItemProperties(strOlField) = fld.Value

generates "Error 450 (Wrong number of arguments or invalid property
assignment)..."

This error does not occur when using early binding.

Any ideas or suggestion appreciated :-)

Many thanks, Jonathan
 
If you chaged the code as suggested and it's still then line

Prop.Value=fld.Value

then I'm out of ideas.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Organize eMails:
<http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6>

Am Sun, 15 Jul 2007 13:50:00 -0700 schrieb Jonathan:
Hi Michael,


Attempting this with Ol07 and Ol03. Same outcome.

Debug.Print fld.Value returns 1
Debug.Print TypeName(fld.Value) returns Long

Many thanks, Jonathan
Am Thu, 12 Jul 2007 14:04:03 -0700 schrieb Jonathan:
:



Is it possible that it doesn't happen with every recordset, and early-/late
binding doesn't really matter? One source for such an error would be that
fld.Value is an object. In that case the Set statement is misssing:

Set myContact.ItemProperties.Item(strOlField).Value = fld.value

Additionally, I'd recommend to always write the property name.
Item(strOlField) is an object, but actually you don't want to set that
object but write something into its Value property. If fld.value is an
object then VB can't know that you actually want to access the Item's
default property, and this would be twice an error:

myContact.ItemProperties.Item(strOlField) = fld.value
Thanks Michael for this. fld.Value is definitely a value. This routine works
with the same recordset when object variables are declared as Outlook
objects. When object variables are set to simple objects this routine fails.
I sure that there is a logical reason for it... I just can't recognise it...

Many thanks, Jonathan


Am Wed, 11 Jul 2007 17:26:02 -0700 schrieb Jonathan:

:

Do you have olContactItem declared somewhere as a constant? If not, that
could be the problem -- the item you're creating will be a MailItem,
not
a
ContactItem because olContactItem will equal zero. (Option Explicit does
wonders for rooting out these little problems.)
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


Thanks Sue, yes I have all my Outlook constants declared in General
Declarations section. I really do appologise for not including this in the
background info of my questions.

Private Const olContactItem = 2


Many thanks,
Jonathan


:

Does this work any better in the late bound code:

myContact.ItemProperties.Item(strOlField) = fld.Value



Thanks for the idea. <sigh>Unfortunitly it still generates the same
error</sigh> .

Many thanks
Jonathan


Hi, I'm updating public folder contacts from MS Access. When I
have
a
reference to the Outlook Object Library the routine does its thing.
However
I'm using Outlook 12 and the other users have Outlook 11. So I want
to
remove
the reference to the Outlook Object Library and declare variables as
[generic] objects instead of outlook.objects. Unfortunitely it now
fails...

The following is the code snippet (contained within a loop of a
recordset)
with the problem. Background is I have a table that maps outlook
contact
fields to database fields. The code retreives (strOlField) the
appropriate
outlook contact field for data insertion.

'Insert an outlook for each database contact
Set myContact = myContactItems.Add(olContactItem)
For Each fld In .Fields
If Not IsNull(fld.Value) Then
strOlField = getOutlookField(fld.Name, strColumn)
If Len(strOlField) > 0 Then
myContact.ItemProperties(strOlField) =
fld.Value
End If
End If
DoEvents
Next fld

The line

myContact.ItemProperties(strOlField) = fld.Value

generates "Error 450 (Wrong number of arguments or invalid property
assignment)..."

This error does not occur when using early binding.

Any ideas or suggestion appreciated :-)

Many thanks, Jonathan
 
Michael Bauer said:
If you chaged the code as suggested and it's still then line

Prop.Value=fld.Value

then I'm out of ideas.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Organize eMails:
<http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6>

Hi Michael, yes I have changed the code as you suggested and yes it still
fails at the line

Prop.Value = fld.Value

I appreciate your attempts. It's still a mystery why this line works when I
reference Outlook objects and does not work when I declare variables as
[generic] objects...

Many thanks, Jonathan
Am Sun, 15 Jul 2007 13:50:00 -0700 schrieb Jonathan:
Hi Michael,


Attempting this with Ol07 and Ol03. Same outcome.

Debug.Print fld.Value returns 1
Debug.Print TypeName(fld.Value) returns Long

Many thanks, Jonathan
Am Thu, 12 Jul 2007 14:04:03 -0700 schrieb Jonathan:

:



Is it possible that it doesn't happen with every recordset, and
early-/late
binding doesn't really matter? One source for such an error would be that
fld.Value is an object. In that case the Set statement is misssing:

Set myContact.ItemProperties.Item(strOlField).Value = fld.value

Additionally, I'd recommend to always write the property name.
Item(strOlField) is an object, but actually you don't want to set that
object but write something into its Value property. If fld.value is an
object then VB can't know that you actually want to access the Item's
default property, and this would be twice an error:

myContact.ItemProperties.Item(strOlField) = fld.value
Thanks Michael for this. fld.Value is definitely a value. This routine
works
with the same recordset when object variables are declared as Outlook
objects. When object variables are set to simple objects this routine
fails.
I sure that there is a logical reason for it... I just can't recognise
it...

Many thanks, Jonathan


Am Wed, 11 Jul 2007 17:26:02 -0700 schrieb Jonathan:

:

Do you have olContactItem declared somewhere as a constant? If not,
that
could be the problem -- the item you're creating will be a MailItem, not
a
ContactItem because olContactItem will equal zero. (Option Explicit does
wonders for rooting out these little problems.)
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


Thanks Sue, yes I have all my Outlook constants declared in General
Declarations section. I really do appologise for not including this in
the
background info of my questions.

Private Const olContactItem = 2


Many thanks,
Jonathan


:

Does this work any better in the late bound code:

myContact.ItemProperties.Item(strOlField) = fld.Value



Thanks for the idea. <sigh>Unfortunitly it still generates the same
error</sigh> .

Many thanks
Jonathan


Hi, I'm updating public folder contacts from MS Access. When I have
a
reference to the Outlook Object Library the routine does its thing.
However
I'm using Outlook 12 and the other users have Outlook 11. So I want
to
remove
the reference to the Outlook Object Library and declare variables
as
[generic] objects instead of outlook.objects. Unfortunitely it now
fails...

The following is the code snippet (contained within a loop of a
recordset)
with the problem. Background is I have a table that maps outlook
contact
fields to database fields. The code retreives (strOlField) the
appropriate
outlook contact field for data insertion.

'Insert an outlook for each database contact
Set myContact = myContactItems.Add(olContactItem)
For Each fld In .Fields
If Not IsNull(fld.Value) Then
strOlField = getOutlookField(fld.Name,
strColumn)
If Len(strOlField) > 0 Then
myContact.ItemProperties(strOlField) =
fld.Value
End If
End If
DoEvents
Next fld

The line

myContact.ItemProperties(strOlField) = fld.Value

generates "Error 450 (Wrong number of arguments or invalid property
assignment)..."

This error does not occur when using early binding.

Any ideas or suggestion appreciated :-)

Many thanks, Jonathan
 
Back
Top