Ask Your Question
0

Form filters in LibreOffice Basic

asked 2020-04-12 20:22:50 +0200

gregorybuck87 gravatar image

updated 2020-04-12 20:32:48 +0200

Ratslinger gravatar image

I need some help with an error.

I am trying to open and filter a form by pushing a push button on another form.

The error is an: "Error 423: Property or method not found: Filter."

Here is the code that generates the error:

  dim frm as object
  dim id as integer

  id = ThisComponent.Drawpage.Forms.getByName("MainForm").getByName("Id").Text
  frm = ThisDatabaseDocument.FormDocuments.getbyname("frmKingdom")
  frm.Filter = "('tblKingdom'.'Id' = " & id & ")"
  frm.open

The line that starts with "frm.Filter" is the one that causes the error. I have tried putting the "frm.open" before the line with "frm.Filter", but the same error still occurred.

Any ideas?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2020-04-12 20:48:43 +0200

Ratslinger gravatar image

updated 2020-04-13 04:09:13 +0200

Hello,

Have a few solutions. One is a global variable and the other is similar to yours. On the surface your problem appears to be mostly because the form is not opened first.

See the samples in my answer here -> Base macro that opens a new/clean record in another form

PassFormDataWithNoGlobal.odb in edited section is what you most likely want

Edit:

Aside from the code in the sample to open the other form, your syntax for the filter in incorrect. Your table and field name need to be surrounded by quotes not apostrophes and quotes within quotes requires double quoting:

frm.Filter = "(""tblKingdom"".""Id"" = " & id & ")"
edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2020-04-12 20:22:50 +0200

Seen: 88 times

Last updated: Apr 13