using isnull with attachment data type

J

Jeri

I'm using Access 2007, with an attachment data type field. I'm trying to
write a code that checks to see if there is a file in the field on a subform
for a particular record. If so, I want a checkbox on the form to change from
"no" to "yes." I've tried using IsNull, like this:

If IsNull(Forms![frm_Survey]![subfrm_Images].Form![Sitemap]) Then
Me.ck_ImageData = False
Else
Me.ck_ImageData = True
End If

This has worked for other data types, but not for this one. Does anyone know
of a way to do this?

Thanks for your consideration,

Jeri
 
S

Scott Lichtenberg

Jeri,

I've never worked with attachments, so I'm not really sure whether this
will help, but take a look at the help text for the Attachement Object.
There are a number of properties that might let you know whether there is
actually an attachment. In particular, the following look like good
candidates:

AttachmentCount Property Gets the number of documents attached to the
specified Attachment control. Read-only Long.
FileName Property Returns the full file name of the
specified attachment. Read-only String.
FileURL Property Returns the Uniform Resource Locator
(URL) of the specified attachment. Read-only String.

I would probably try checking whether the attachment count is zero.


Scott
 
J

Jeri

The attachmentcount property did the trick. I hadn't found that one yet.
Thank you so much.

Jeri

Scott Lichtenberg said:
Jeri,

I've never worked with attachments, so I'm not really sure whether this
will help, but take a look at the help text for the Attachement Object.
There are a number of properties that might let you know whether there is
actually an attachment. In particular, the following look like good
candidates:

AttachmentCount Property Gets the number of documents attached to the
specified Attachment control. Read-only Long.
FileName Property Returns the full file name of the
specified attachment. Read-only String.
FileURL Property Returns the Uniform Resource Locator
(URL) of the specified attachment. Read-only String.

I would probably try checking whether the attachment count is zero.


Scott



Jeri said:
I'm using Access 2007, with an attachment data type field. I'm trying to
write a code that checks to see if there is a file in the field on a
subform
for a particular record. If so, I want a checkbox on the form to change
from
"no" to "yes." I've tried using IsNull, like this:

If IsNull(Forms![frm_Survey]![subfrm_Images].Form![Sitemap]) Then
Me.ck_ImageData = False
Else
Me.ck_ImageData = True
End If

This has worked for other data types, but not for this one. Does anyone
know
of a way to do this?

Thanks for your consideration,

Jeri
 
G

Gary B

Hi Jeri,

Could you post your final code on here ?

Regards

Jeri said:
The attachmentcount property did the trick. I hadn't found that one yet.
Thank you so much.

Jeri

Scott Lichtenberg said:
Jeri,

I've never worked with attachments, so I'm not really sure whether this
will help, but take a look at the help text for the Attachement Object.
There are a number of properties that might let you know whether there is
actually an attachment. In particular, the following look like good
candidates:

AttachmentCount Property Gets the number of documents attached to the
specified Attachment control. Read-only Long.
FileName Property Returns the full file name of the
specified attachment. Read-only String.
FileURL Property Returns the Uniform Resource Locator
(URL) of the specified attachment. Read-only String.

I would probably try checking whether the attachment count is zero.


Scott



Jeri said:
I'm using Access 2007, with an attachment data type field. I'm trying to
write a code that checks to see if there is a file in the field on a
subform
for a particular record. If so, I want a checkbox on the form to change
from
"no" to "yes." I've tried using IsNull, like this:

If IsNull(Forms![frm_Survey]![subfrm_Images].Form![Sitemap]) Then
Me.ck_ImageData = False
Else
Me.ck_ImageData = True
End If

This has worked for other data types, but not for this one. Does anyone
know
of a way to do this?

Thanks for your consideration,

Jeri
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top