converting data type in report

J

JB

Hello
I have a form which has a frame to show an image relating to each record.
(has a button get image event)
The property type for the field in the underlying table is 'text'
I'd like to create a report that shows all the records but I want a column
called 'Image' that instead of showing the name of the embedded image, or
the image itself, I want it to say
'Yes' for if an image has been added
or 'No' if no image has been added.

Is this possible? and if so how?
Please
Jen
 
S

Stuart McCall

JB said:
Hello
I have a form which has a frame to show an image relating to each record.
(has a button get image event)
The property type for the field in the underlying table is 'text'
I'd like to create a report that shows all the records but I want a column
called 'Image' that instead of showing the name of the embedded image, or
the image itself, I want it to say
'Yes' for if an image has been added
or 'No' if no image has been added.

Is this possible? and if so how?
Please
Jen

Try this: in the query the report is based on, in the Field row of the
design grid, type:

Image: IIf(Len([MyTable].[Image])>0,"Yes","No")

Substitute your table and field names, of course.
 
J

JB

Fantastic. That's so cool. Thank you!
Now can that it be turned into a tick box in the report!!??
Thanks


Stuart McCall said:
JB said:
Hello
I have a form which has a frame to show an image relating to each record.
(has a button get image event)
The property type for the field in the underlying table is 'text'
I'd like to create a report that shows all the records but I want a
column called 'Image' that instead of showing the name of the embedded
image, or the image itself, I want it to say
'Yes' for if an image has been added
or 'No' if no image has been added.

Is this possible? and if so how?
Please
Jen

Try this: in the query the report is based on, in the Field row of the
design grid, type:

Image: IIf(Len([MyTable].[Image])>0,"Yes","No")

Substitute your table and field names, of course.
 
S

Stuart McCall

JB said:
Fantastic. That's so cool. Thank you!
Now can that it be turned into a tick box in the report!!??
Thanks


Stuart McCall said:
JB said:
Hello
I have a form which has a frame to show an image relating to each
record. (has a button get image event)
The property type for the field in the underlying table is 'text'
I'd like to create a report that shows all the records but I want a
column called 'Image' that instead of showing the name of the embedded
image, or the image itself, I want it to say
'Yes' for if an image has been added
or 'No' if no image has been added.

Is this possible? and if so how?
Please
Jen

Try this: in the query the report is based on, in the Field row of the
design grid, type:

Image: IIf(Len([MyTable].[Image])>0,"Yes","No")

Substitute your table and field names, of course.

Well for a checkbox you don't want "Yes" and "No". You need a boolean column
instead. Using my previous example, that would be:

Image: Len([MyTable].[Image])>0
 
J

JB

The query returned -1 for the ones that have an image.
What do I do next as I'm not sure how that changes to a tick box on the form
as I can't see the option.
Jen

Stuart McCall said:
JB said:
Fantastic. That's so cool. Thank you!
Now can that it be turned into a tick box in the report!!??
Thanks


Stuart McCall said:
Hello
I have a form which has a frame to show an image relating to each
record. (has a button get image event)
The property type for the field in the underlying table is 'text'
I'd like to create a report that shows all the records but I want a
column called 'Image' that instead of showing the name of the embedded
image, or the image itself, I want it to say
'Yes' for if an image has been added
or 'No' if no image has been added.

Is this possible? and if so how?
Please
Jen

Try this: in the query the report is based on, in the Field row of the
design grid, type:

Image: IIf(Len([MyTable].[Image])>0,"Yes","No")

Substitute your table and field names, of course.

Well for a checkbox you don't want "Yes" and "No". You need a boolean
column instead. Using my previous example, that would be:

Image: Len([MyTable].[Image])>0
 
S

Stuart McCall

JB said:
The query returned -1 for the ones that have an image.
What do I do next as I'm not sure how that changes to a tick box on the
form as I can't see the option.
Jen

Stuart McCall said:
JB said:
Fantastic. That's so cool. Thank you!
Now can that it be turned into a tick box in the report!!??
Thanks


Hello
I have a form which has a frame to show an image relating to each
record. (has a button get image event)
The property type for the field in the underlying table is 'text'
I'd like to create a report that shows all the records but I want a
column called 'Image' that instead of showing the name of the embedded
image, or the image itself, I want it to say
'Yes' for if an image has been added
or 'No' if no image has been added.

Is this possible? and if so how?
Please
Jen

Try this: in the query the report is based on, in the Field row of the
design grid, type:

Image: IIf(Len([MyTable].[Image])>0,"Yes","No")

Substitute your table and field names, of course.

Well for a checkbox you don't want "Yes" and "No". You need a boolean
column instead. Using my previous example, that would be:

Image: Len([MyTable].[Image])>0

Open the form in design view, select the checkbox and set its controlsource
property to the name of the new query column (ie Image). That's it.
 
J

JB

Stuart McCall said:
JB said:
The query returned -1 for the ones that have an image.
What do I do next as I'm not sure how that changes to a tick box on the
form as I can't see the option.
Jen

Stuart McCall said:
Fantastic. That's so cool. Thank you!
Now can that it be turned into a tick box in the report!!??
Thanks


Hello
I have a form which has a frame to show an image relating to each
record. (has a button get image event)
The property type for the field in the underlying table is 'text'
I'd like to create a report that shows all the records but I want a
column called 'Image' that instead of showing the name of the
embedded image, or the image itself, I want it to say
'Yes' for if an image has been added
or 'No' if no image has been added.

Is this possible? and if so how?
Please
Jen

Try this: in the query the report is based on, in the Field row of the
design grid, type:

Image: IIf(Len([MyTable].[Image])>0,"Yes","No")

Substitute your table and field names, of course.

Well for a checkbox you don't want "Yes" and "No". You need a boolean
column instead. Using my previous example, that would be:

Image: Len([MyTable].[Image])>0

Open the form in design view, select the checkbox and set its
controlsource property to the name of the new query column (ie Image).
That's it.



Thank you for your patience.
I don't know why it's not working.
The query has the
Image: Len([tbleSketches].[Image])>0

The controlsource in the report is set on Image (from the query) but still
showing -1.

What have I missed?
Jen
 
M

Mike Painter

JB wrote:
Open the form in design view, select the checkbox and set its
controlsource property to the name of the new query column (ie
Image). That's it.



Thank you for your patience.
I don't know why it's not working.
The query has the
Image: Len([tbleSketches].[Image])>0

The controlsource in the report is set on Image (from the query) but
still showing -1.

What have I missed?
Jen

What is mentioned above, you must add a checkbox to the report and bind it
to Image.
 
J

John W. Vinson

The controlsource in the report is set on Image (from the query) but still
showing -1.

What have I missed?

It would seem that you have the Image field bound to a Textbox control on the
form.

Use a Checkbox control instead.

Either right click the textbox showing the -1 and change it to Checkbox, or
delete the textbox and use the toolbox to add a new Checkbox control.

Don't confuse data STORAGE - yes/no fields are stored as -1 for Yes, True,
Checked and 0 for No, False, Unchecked - with data DISPLAY. Tables do not
contain checkboxes (a display tool); they contain data, which can be displayed
in many ways.
 

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