Ask Your Question
0

Create a macro in odb to change a table in table control

asked 2019-09-30 21:46:40 +0200

templariomaster gravatar image

Hi all there.

I have to do a certain task, that would otherwise not require this, but it's asked anyway.

The task is to create a form, in which the user can check the data of a table and modify the contents of that table through buttons, and therefore, I need to write the macros that affect the table control element in the form and more specifically columns.

To be more precise I have to create buttons to:

1-Change all the values of a column of the table from S to N(and would be very nice to be able to switch back)

2-Hide a specific column from the table

3-Create a small filter that will make the table show only one specific result(aka search engine, I was thinking about adding a filter for one column and the data of the filter should be a string taken from a textbox)

Now, I'm not really... that experienced writing macros and most of the things I have managed so far have been thanks to small tutorials and a manual, but I'm still left dazzled by many things, because I don't know how to make the code reference the table control and change it, I have only been able to add text to the form in itself and parts of it and recording the macro has not helped(doesn't seem to record anything that happens inside table control).

So if I were to be more specific: How can I make a macro for an element inside a form and what functions and syntaxis do I have avaliable to change things inside a table control?

The table I want to change is inside the odb.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2019-09-30 23:10:06 +0200

Ratslinger gravatar image

Hello,

Your question is actually many questions in one. Please keep to single questions as this is how the site is designed to work. Multiple question answers will get buried from others looking for similar answers.

You are talking about a number of macros here. First would be changing the content of the internal form itself from one table to another. You also need to modify (and seems implied here) the table control. There you would not only need to change column references to fields but possibly type and add or delete columns.

You are much better off with defining all tables and table controls and simply hiding or revealing them. Have attached a sample that uses a few small macros. Macros could be written differently but tried to be as transparent as possible as you state limited experience. There is one form with a list box. This is a list of available tables. Selecting one will reveal a table control for the table. When selecting the 'EmployeeTable' there will also appear button to hide/reveal a column in the table control. Now you can also apply similar functionality using these methods for the filtering you mention.

Keep in mind this is only a quick sample and does not include many functions which may be wanted. For example, if you start to enter data on a record in one table control and in the middle of entry switch to another table, the change will be saved. There are way too many options to discuss each of them here.

Sample ------ MultiTableSelectionEntry.odb

You may also see much more regarding macros in the book Open Office Macros Explained by Andrew Pitonyak. PDF here -> OOME and AndrewBase -> Here.

edit flag offensive delete link more

Comments

If this answers your question please tick the ✔ (upper left area of answer). It helps others to know there was an accepted answer.

Ratslinger gravatar imageRatslinger ( 2019-09-30 23:11:47 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2019-09-30 21:46:40 +0200

Seen: 33 times

Last updated: Sep 30