Results 1 to 6 of 6
  1. #1
    Join Date
    May 2004
    Posts
    55

    Unanswered: Bound Object Frame

    I have two pictures on a form that come from two different tables. I am never going to need both the pictures at the same time. I was wondering if I could just have one bound object frame and use an if statement to change the table names. Is this possible?

  2. #2
    Join Date
    Jun 2004
    Posts
    96
    u can bound the image during runtime, by using the OnCurrent event in the form. Change the source for the bound image accordingly.

    Cyherus

  3. #3
    Join Date
    May 2004
    Posts
    55
    Quote Originally Posted by Cyherus
    u can bound the image during runtime, by using the OnCurrent event in the form. Change the source for the bound image accordingly.

    Cyherus
    I didn't quite get you..I have two tables PICTURE and PICTURE1 with fields
    Pic and Tool No...Both are joined to Tool No in the MASTER table.

    On the form I have a frame 'Picture'. Currently the source is PICTURE.Pic. I want it to be PICTURE.Pic or PICTURE1.Pic depending on the Tool No.

    I hope this makes sense. I really need some help with this.

    Thanks,
    SH

  4. #4
    Join Date
    Jun 2004
    Posts
    96
    to work around this, you can create a query to hold either pictures from PICTURE or PICTURE1 depending on which is available. then use this query as the source for your form.

    below query will select either picture1.pic or picture.pic and place them in a new field call pict.

    SELECT MASTER.name, MASTER.[tool no], IIf([picture1].[pic],[picture1].[pic],[picture].[pic]) AS pict
    FROM PICTURE1 RIGHT JOIN (PICTURE RIGHT JOIN MASTER ON PICTURE.[tool no] = MASTER.[tool no]) ON PICTURE1.[tool no] = MASTER.[tool no];

    in your form, use this query as the recordsource and create a bound object frame with source bound to "pict".. this should work, I did an example and it works for me.

    Cyherus

  5. #5
    Join Date
    May 2004
    Posts
    55
    Quote Originally Posted by Cyherus
    to work around this, you can create a query to hold either pictures from PICTURE or PICTURE1 depending on which is available. then use this query as the source for your form.

    below query will select either picture1.pic or picture.pic and place them in a new field call pict.

    SELECT MASTER.name, MASTER.[tool no], IIf([picture1].[pic],[picture1].[pic],[picture].[pic]) AS pict
    FROM PICTURE1 RIGHT JOIN (PICTURE RIGHT JOIN MASTER ON PICTURE.[tool no] = MASTER.[tool no]) ON PICTURE1.[tool no] = MASTER.[tool no];

    in your form, use this query as the recordsource and create a bound object frame with source bound to "pict".. this should work, I did an example and it works for me.



    Cyherus
    This is what I have:

    SELECT PICTURE.Picture, PICTURE1.Picture, DATA.Group, DATA.After_Change, DATA.EngineType, DATA.PartNomen, DATA.変更前, DATA.[Repair No], DATA.[Tool No], DATA.[GJ No], DATA.[RE No], DATA.Weight, DATA.[Fit Check], DATA.[Open Date], DATA.[Close Date], DATA.固資No, DATA.Remark, IIf([PICTURE1].[Picture],[PICTURE].[Picture]) AS Picture
    FROM PICTURE1 RIGHT JOIN (PICTURE RIGHT JOIN DATA ON PICTURE.[Tool No] = DATA.[Tool No]) ON PICTURE1.[Tool No] = DATA.[Tool No]
    WHERE (((DATA.[Tool No]) Like [Forms]![LOC_DETAIL]![Tool No]));

    You had IIf([picture1].[pic],[picture1].[pic],[picture].[pic]) AS pict

    Is that a typo?? It still doesn't work..it show all everything except the picture...I even ran the query and all the fields seem to have information except Picture or pict (name you gave).
    PICTURE.Picture and PICTURE1.Picture have a picture.

    Am I doing something wrong

  6. #6
    Join Date
    Jun 2004
    Posts
    96
    Not a typo: IIF([PICTURE1].pic,[PICTURE1].pic,[PICTURE].pic) as PICT.

    This statement is checking if picture1.pic is null (has no value), if it is null, it will put [picture1].pic in that field, else it will put [picture].pic in that field.

    It can also be interpreted as IIF(Nz([Picture1].pic)="", true=put this, false=put that) As NewFieldName
    Nz() is a function to check if the field is null in Access query.

    I suggest you try to find the help in access regarding the functions written here, in order for you to understand what we are trying to do.

    look up: IIF, Nz

    Cyherus

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •