Viewing images in Base

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")
    '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 statementBASIC syntax error.
Expected: Case.`

If I try a Filter statement

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

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. :smiley:
Thanks for your patience, and help.

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

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., 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.


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.

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


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.

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