Ask Your Question

Macro to copy a field from a View Table on Base [closed]

asked 2018-07-30 22:25:34 +0100

ehesh gravatar image

updated 2020-07-20 23:21:43 +0100

Alex Kemp gravatar image

I am trying to create a push button on a form to copy a field from a view table depending on the entry,

For example on entry 1 of the form, I want to reference entry 1 on the view table. but I don't know how to reference the view table or match the entry number from the form to the view table

This is a continuation of a previous question which can be viewed here.

I have included a file as an example of the current DB.

What I want to do is have the format of the field FieldA, FieldB, FieldC and FieldD on the clipboard, as indicated on View1 from the file below.


edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2020-07-20 23:22:01.128149


@ehesh This question is very vague. The View is based upon information from other table(s). A View can be in any sequence and not necessarily the same as where it originated from. What relation is there for 'entry 1' on the form and 'entry 1' in the View? Should be a connection. Also you need to be specific as to what is being copied & what you are going to do with it. Why is a View even involved? Is this concerning the concatenated field previously discussed? Need clarity.

Ratslinger gravatar imageRatslinger ( 2018-07-30 22:43:51 +0100 )edit

yeah, it is regarding the concatenated field previously discussed. I added more details to my question above as well as a modified version of the file you initially provided. I removed the text boxes since they were not really needed if I had them on the View, but I kept the code/formula in order to set up View1. What I need now is to have them on the concatenated field on the clipboard with the push of the button

ehesh gravatar imageehesh ( 2018-07-31 00:08:59 +0100 )edit

So you just want the result on the clipboard?

Ratslinger gravatar imageRatslinger ( 2018-07-31 00:35:12 +0100 )edit

1 Answer

Sort by » oldest newest most voted

answered 2018-07-31 00:27:31 +0100

Ratslinger gravatar image

updated 2018-07-31 00:51:18 +0100


Edited version:

Apoligies for not reading your comment close enough. You still don't need a view.

In my opinion this is in opposition to all I've stated before and even further now. Why even create a View when, if you insist on duplicating this information, you can do it right at entry time. Hope you understand that macros are not the easiest thing to comprehend. It takes some time to absorb the details on how to do things. Here is a working sample:

Sample ---- DisplayConcatonatedFields.odb

Modified form FieldTable to be FieldTableWithButton and the push button copies the field to the clipboard using the macro found here -> BASIC Macro to Copy textbox value to clipboard. It was only slightly modified to fit the situation.

Since, through experience, I realize the tasks ahead for you, here is the best reference for LO macros. Book written by Andrew Pitonyak (PDF) - Open Office Macros Explained.

edit flag offensive delete link more


BTW The text boxes on the form displaying the concatenated text are not necessary for the macro to work.

Ratslinger gravatar imageRatslinger ( 2018-07-31 01:02:19 +0100 )edit

After I click the button the field labels disappear. Is that supposed to happen?

ehesh gravatar imageehesh ( 2018-08-03 00:23:27 +0100 )edit

No. You have not stated (in any of your questions) what OS & which LO version you are using. This is basic info when asking any question (Base should include more depending on the question). Please provide. Did this happen on the provided sample or on your form? Did the copy to clipboard work for you? Have no problems on Mint 18.3 as you state and copy to clipboard works.

Ratslinger gravatar imageRatslinger ( 2018-08-03 00:53:48 +0100 )edit

nevermind. if I scroll they come back.

ehesh gravatar imageehesh ( 2018-08-03 01:17:36 +0100 )edit

Question Tools

1 follower


Asked: 2018-07-30 22:25:34 +0100

Seen: 103 times

Last updated: Jul 31 '18