Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    Middlemarch is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Mar 2015
    Posts
    365

    Image control - continuous view Form - setting visible or not visible

    I'm looking for a way to show or not show this image depending on it's control source. This is set
    true or false in the table it's bound to. But the image is showing regardless (and on every record).

    Am I on the right track, or is such a task not possible?


    Thanks for any help.

  2. #2
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 8 Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    If it is on a continuous form - probably not. You can either show what the control contains which is either the string or the image as an object...

    is it a continuous form?

  3. #3
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 8 Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    the Form On Current event will allow from record to record events

  4. #4
    Middlemarch is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Mar 2015
    Posts
    365
    Hi Ruegen, yes it is a continuous form. What did mean by "Form On Current event will allow" ? Can i use that?

    I was also thinking would Filter work ? (Googling madly here but not finding the right stuff!)

  5. #5
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 8 Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    Quote Originally Posted by Middlemarch View Post
    Hi Ruegen, yes it is a continuous form. What did mean by "Form On Current event will allow" ? Can i use that?

    I was also thinking would Filter work ? (Googling madly here but not finding the right stuff!)
    The problem with access is that it treats a continuous form as one form (one form displaying multiple records).

    So when you change a control (like say a button or a text box) on the form you are changing it for the form and not the record - with me so far?

    so when you say hide picture box control - it hides them for all because it is hiding the form control (not the single record one)

    What you can do is break something if it is false/true

    so if you have a string with a url of an image of the person of the record, say a folder/file path... you could break the path in the query so it can't read the path then your image of course won't show

    so

    iif(DontShow = true, "","folder/image.jpg")

    this way if true it will make a "" string on the custom query field

    then the control "source" of the control will be "" for that record.

    that's how I would get around it....

    instead of "" you could also have a generic icon/jpeg to sybolize an image hasn't been added yet - "folder/noimg.jpg"

  6. #6
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 8 Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    Your other question

    check the properties of the form (the main form not the detail or header section)

    There will be form events - actions that fire off when certain things happen like opening or closing a form

    there is one for current (which means currently opened and viewable record) which when used can fire events on the form according to the record - this becomes superfluous when you have a continuous form.

  7. #7
    Middlemarch is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Mar 2015
    Posts
    365
    Thanks Ruegen... those magic words " can do " !!
    I can see the logic behind the iif statement, but can't figure where it goes.
    You've highlit "custom" query but it doesn't mean much to me yet.
    The condition to show the image is a Yes/No field in Form footer (so it can't be seen) and the image control on the form points to a bmp. (I used bmp as the quality was magic compared to jpg.)

    If that can show for certain records only, I'll shout you 15 schooners !

    Yes, with you on the global sate of continuous view and Form Current.

  8. #8
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 8 Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    Quote Originally Posted by Middlemarch View Post
    Thanks Ruegen... those magic words " can do " !!
    I can see the logic behind the iif statement, but can't figure where it goes.
    You've highlit "custom" query but it doesn't mean much to me yet.
    The condition to show the image is a Yes/No field in Form footer (so it can't be seen) and the image control on the form points to a bmp. (I used bmp as the quality was magic compared to jpg.)

    If that can show for certain records only, I'll shout you 15 schooners !

    Yes, with you on the global sate of continuous view and Form Current.
    I would put the Iif statement in the custom field

    Each form has a control source property - either it is blank and not bound to a table or query of records (or raw typed sql) or it is bound to one of them. You have the option of creating a query of table and then in that query writing your own fields next to the others.

    CustomPicture: iif(forms!myForm!myCheckBox=true,"",[FieldPathOfImage])

    that way the field Custom Picture will break for a record once the checkbox is clicked

    The form would need to be "required" for it to work each time it was clicked so the action on the checkbox would be on the after update property of that checkbox

    me.requery '<==this will requery the form

    however it will make all the images disappear and since you have the checkbox in the footer it for all the images - if you don't want this each record will have to have their own yes/no field in their row so that you can individually remove it.

    if you are planning to remove the whole control or make invisible entirely I would (note me. is the intelli for "form")

    if me.myCheckbox = true then
    me.ImageControl.visible = false
    else
    me.ImageControl.visible = true
    end if

    now all the picture boxes on the form will vanish from sight on every record.

  9. #9
    Middlemarch is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Mar 2015
    Posts
    365
    Not getting very far, and normally I could fix the error I'm getting ... except this time!

    Your

    iif(forms!myForm!myCheckBox=true,"",[FieldPathOfImage])

    changing to what I think is right gives
    Syntax error (missing operator) in query expression 'CustomPicture: iif(Form_FrmMyTest![B Side Title Comment]=true,"",[Image244])'.

    I replaced [Image244], which I though could be wrong, with "" but got the same error again.

    B Side Title Comment is the namer of Yes/No field and Image 244 is the name of the Image control.

  10. #10
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 8 Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    Quote Originally Posted by Middlemarch View Post
    Not getting very far, and normally I could fix the error I'm getting ... except this time!

    Your

    iif(forms!myForm!myCheckBox=true,"",[FieldPathOfImage])

    changing to what I think is right gives
    Syntax error (missing operator) in query expression 'CustomPicture: iif(Form_FrmMyTest![B Side Title Comment]=true,"",[Image244])'.

    I replaced [Image244], which I though could be wrong, with "" but got the same error again.

    B Side Title Comment is the namer of Yes/No field and Image 244 is the name of the Image control.
    to test type 1 where [Image 244] is

    Is [Image 244] a field?

    Is it a string field?

    Operators are
    & < >= etc

    Or !

    So check you have it correct with

    Form_FrmMyTest![B Side Title Comment]

    I always use

    [Forms]![frmMYTest]![B Side Title Comment]

    Also I noticed you have spaces - in programming you don't want those so the control name should be renamed on the form

    B Side Title Comment

    To

    chkBSideTitleComment

    If it's a combo box then you start with cbo, text field with txt and so on

    The 3 letter abbreviation is an informal convention your controls.

    qryMyQuery

    frmMyForm

    tblMyTable

    In programming, variables start with small characters too so it's wise to keep things consistent. I use strMyString or intMyInteger

    This helps later as you can use variables to load temp variables which can be used in querying

    Tempvars!tmpMyInteger

  11. #11
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 8 Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496

  12. #12
    Middlemarch is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Mar 2015
    Posts
    365
    OK on the naming conventions, will do. ? [Forms]![frmMYTest]![B Side Title Comment] is 0 (as is Form_FrmMyTest![B Side Title Comment])
    I will remove the spaces.
    Still can't work out what goes into the query. Image244 is the name of the image control. I'll rename that too.
    Once the query is OK I can see the results, as I'm not too sure what to expect or where me.requery would go.
    But keen to see the outcome.

  13. #13
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 8 Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    Image244 is the string path of your jpeg'

    You have to store the images of all the records somewhere on the computer. Adding them to the database increases the size of the database. Putting them all in a folder is suggested. When you use a control on the form it's control source will be the field which will either be "" or the string path.

    me.requery would go on the checkbox afterupdate property

    the second half of this video explains the file path stuff
    https://www.youtube.com/watch?v=7qmM0UT-u1I

  14. #14
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 8 Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    anything within double quotes "" is a string

    so "abcdefghik" or "123445" is a string even though the second has numbers.

    A string contains a collection or group of character data types

    a is a character
    b is a character
    and so on

    but rather than write code that way for the computer - you put them into a string "" and it reads them that way

    so a string path is just something like this

    "C:\Users\Ruegen\Desktop\MyPhotos\image.jpg"

    It's a string and a path to a file on my computer..

    you may or may not already know this but if it helps then it might clarify what I mean.

  15. #15
    Middlemarch is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Mar 2015
    Posts
    365
    Hi Ruegen,

    Fascinating sort of task this, and I have got there, I think !!

    The command 'CustomPicture: iif(Form_FrmMyTest![B Side Title Comment]=true,"",[Image244])'. was failing. First I thought because
    B Side Title Comment is also a custom field. But then I figured that is part of the underlying query for the Form and should be based on the Table.

    So I changed it and running up the query shows Custom Picture field has a filespec to a bmp when my Yes/No field is ticked, and is empty where it's false.

    Is that about right so far?

    In my Form I have an image control and it's control source is CustomPicture. And Viola! my graphic shows where and when it should

    But there's a But! I didn't add requery or anything else (yet) and that might be part of it... but it is too slow loading the image. It's pretty small (under 2k)
    but could I try and embed it in the database to see if it would it be faster. there's about 18000 rows or records in the Form.

    A zillion thanks for sticking with me over this!

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

Similar Threads

  1. Replies: 4
    Last Post: 11-04-2014, 07:35 PM
  2. Replies: 3
    Last Post: 03-29-2012, 12:40 PM
  3. Data not visible in Form view
    By CASmith in forum Forms
    Replies: 8
    Last Post: 12-23-2011, 04:02 PM
  4. Replies: 2
    Last Post: 01-06-2011, 04:38 AM
  5. Query results visible in a form view in Access
    By pawelek022 in forum Forms
    Replies: 0
    Last Post: 11-30-2010, 01:25 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