Ask Your Question
0

Viewing images in Base [closed]

asked 2019-07-02 15:35:31 +0200

LSemmens gravatar image

updated 2019-07-04 03:46:09 +0200

Ratslinger gravatar image

I have images stored as a Text(varchar) in my table. I can see the image in my main form. What I am hoping to be able to do is doubleclick on that image displayed in the form and view it at full size. I am aware that I could re-size the underlying control to show it larger on the page, but that is often a waste of screen space as I only occasionally need to enlarge the occasional image.

What commands do I need to investigate to achieve that end. In VBA it would have used the DoCmd.OpenForm method to open another form to display said image.

Edit: I just realised that dblClick is used to insert an image so that might not be a consideration.

I've created a new form with just the image and the unique number in it. but every time I try and write a query or filter to only show the current image I get an error message

my current code looks like this:

`Sub OpenFormImage
  Dim oForm     'Reference to the form containing the primary record.
  Dim oSubForm  'Reference to the subform containing the data
  Dim lSG

  Dim DispForm
  Dim myFilter
    oForm = ThisComponent.DrawPage.Forms.getByIndex(0)    ' Main Form
    oSubForm = oForm.GetByName("Stamp")              ' SubForm Name
    lSG = oSubForm.findColumn("SM_SG_REF")
    sSG = oSubForm.getString(lSG)
    DispForm = ThisDatabaseDocument.FormDocuments.getbyname("frmImage")
    DispForm.open
    SELECT DISTINCT "SM_SG_REF" AS "SM_SG_REF", "SM_IMAGE" FROM "MASTER" ORDER BY "SM_SG_REF" ASC
    'WHERE "SM_SG_REF" = "sSG" <<< note I have commented this statement deliberately for now
End Sub

The error message returns a problem with the SELECT statement BASIC syntax error. Expected: Case.`

If I try a Filter statement

myFilter = "('SM_SG_REF' = " & sSG & ")"
DispForm.filter = myFilter
DispForm.Reload()

I get a

BASIC runtime error.
Property or method not found: filter.

I'm sure I'm missing something simple but no amount of searching seems to provide anything useful.

SM_SG_REF is a field in the related MAIN database that stores a unique number as a Text(VARCHAR) and sSG is the variable that stores the value for that field in the current record. So, when I open the new form, all I want to see is that ONE RECORD.

If I remove the filter conditions I get the new form ok and I can browse all records. I DO NOT WANT THAT. :D Thanks for your patience, and help.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by LSemmens
close date 2019-07-05 17:29:28.964142

Comments

Solved it using the Shell command to pix. Thank you for giving me some ideas.

LSemmens gravatar imageLSemmens ( 2019-07-05 17:29:12 +0200 )edit

2 Answers

Sort by » oldest newest most voted
0

answered 2019-07-02 23:23:14 +0200

Ratslinger gravatar image

updated 2019-07-04 03:44:56 +0200

Hello,

I chose when moving from Access to Base NOT to use Access2Base and rather learn basic as directly applied to LO. Have also learned some Python and progressing toward that. So can't give you specific code as in your NOT an Answer Answer.

You can do this using macros in multiple ways. One is to open in a different form as you elude to. A similar situation can be seen in my answer in this post -> Base macro that opens a new/clean record in another form. Sample uses LO basic code in the macros.

You can also open this in your favorite viewer since you have the URL. Use the Shell command. Some examples here -> How to use shell from basic macro. Also see -> Shell Function [Runtime]

Edit 2019-07-03:

First, your statement:

DispForm.filter = myFilter

is incorrect. Should be:

DispForm.Filter = myFilter

Yes, it is a small difference but very important in API.

Next you are going to have many problems with your routine. The sample in the link provided above has two possibilities: using a "Global" variable (code in Module1) or no "Global" variables (code in Module2).

You are using neither process. There is no global variable. It also requires an "Open Document" event if using the global method.

Follow Module2 method. Use the subroutine GetID(). This is most in tune with what you want. All code is executed from the originating form but requires special attention to how each form is actually accessed.

edit flag offensive delete link more

Comments

The global variable sSG was set as I thought that maybe it was being released when opening the new form (it was not - I shall restore it to it's rightful place as I like to keep things tidy - sometimes)

I tried all variants of the word Filter from all lowercase to all caps and Cap case and got exactly the same error message every time.

I shall now research GetID(). Thanks for you time

LSemmens gravatar imageLSemmens ( 2019-07-04 04:23:16 +0200 )edit
0

answered 2019-07-02 16:27:54 +0200

LSemmens gravatar image

I've re-done the code to use a button and a called form. Now all I'm having trouble with is

BASIC runtime error. Property or method not found: Filter

When I use "DispForm.Filter = ("SM_SG_REF = " & sSG)"

DispForm is the called form and works, i.e. DispForm.open, opens the form. SM_SG_REF is a unique reference field and sSG is the stored data from the main form.

It appears that the FILTER method does not exist.

edit flag offensive delete link more

Comments

@LSemmens,

You have been asked multiple times before:

Please only use answer to respond to original question. Use add a comment for remarks or edit original question if providing additional information.

Ratslinger gravatar imageRatslinger ( 2019-07-02 17:53:47 +0200 )edit

My apologies, I have trouble remembering my username let alone the various forms on different fora. I shall attempt to do better in future.

LSemmens gravatar imageLSemmens ( 2019-07-03 02:10:22 +0200 )edit

Question Tools

1 follower

Stats

Asked: 2019-07-02 15:35:31 +0200

Seen: 41 times

Last updated: Jul 04