Ask Your Question

meakasteve's profile - activity

2018-03-19 21:55:39 +0100 received badge  Famous Question (source)
2018-01-11 19:16:54 +0100 received badge  Famous Question (source)
2017-10-17 11:14:41 +0100 received badge  Notable Question (source)
2017-08-11 12:21:27 +0100 commented answer Base macro transfering text from Word Doc to Textbox

I had not thought of a SQL/Table solution but I think the idea is great and well worth pursuing. Elsewhere in my databas

2017-08-11 12:18:39 +0100 marked best answer Base macro transfering text from Word Doc to Textbox

Recently the question was asked How do I open a Word document from a Base macro? The solution given works wonderfully but how should the code be altered so that the text will appear in a scroll textbox on the form?

To be specific: I'm trying to get the text contained in a writer document into a text box of a database. The idea is to use the text box as a 'Help' guide, giving an inexperienced user of the database information about what the various buttons etc on the form that he/she is presently looking at, do. The text for each particular form would be held in a separate writer document and its contents would be displayed by the macro when the relevant form is opened. The previous solution mentioned above displays the whole document in a separate window rather than having it displayed on the form itself and is therefore inconvenient as a 'Help' text. But the advantage of having the text on a writer file rather than embedded in the macro lies in the convenience with which the text could be modified and maintained.

I have written a macro that gets a text explicitly quoted within the macro into the box (hardly, I agree, a great feat!) and I know how to connect the macro with the open (Base) document event. What I still need to do is to capture the raw text from the writer document and insert it into my Base macro which then puts it into the text box. I think the problem is that I have no idea about writer macro commands. My hope is that someone well-conversed with macros for writer can help me. My present project is developing a rather complex database and I would appreciate any help on, at least for me at the moment, the 'fringe' topic of writer macros!

Bottom Line: I am hoping that someone on the forum can share with me the couple of lines of script that illustrate how to grab the text from the document. With that clue I hope that I can write the the rest of the code.

If you can help I would be most grateful.

2017-08-11 12:18:26 +0100 commented answer Base macro transfering text from Word Doc to Textbox

I had not thought of SQL/Table solution but I think the idea is great and well worth pursuing. Elsewhere in my database

2017-08-11 12:17:29 +0100 commented answer Base macro transfering text from Word Doc to Textbox

I had not thought of SQL/Table solution but I think the idea great and well worth pursuing. Elsewhere in my database I a

2017-08-11 04:41:35 +0100 received badge  Notable Question (source)
2017-08-10 23:08:06 +0100 commented question Base macro transfering text from Word Doc to Textbox

Hi Ratslinger! First my profound apologies. After uploading my question I thought it might be seen as rather curt. (I al

2017-08-10 23:04:43 +0100 edited question Base macro transfering text from Word Doc to Textbox

Base macro transfering text from Word Doc to Textbox Recently the question was asked How do I open a Word document from

2017-08-10 23:04:00 +0100 edited question Base macro transfering text from Word Doc to Textbox

Base macro transfering text from Word Doc to Textbox Recently the question was asked How do I open a Word document from

2017-08-10 22:51:51 +0100 edited question Base macro transfering text from Word Doc to Textbox

Base macro transfering text from Word Doc to Textbox Recently the question was asked How do I open a Word document from

2017-08-10 22:33:40 +0100 commented question Base macro transfering text from Word Doc to Textbox

Hi Ratslinger! First my profound apologies. After uploading my question I thought it might be seen as rather curt. (I al

2017-08-10 22:14:17 +0100 received badge  Popular Question (source)
2017-08-10 22:07:47 +0100 edited question Base macro transfering text from Word Doc to Textbox

Base macro transfering text from Word Doc to Textbox Recently the question was asked How do I open a Word document from

2017-08-10 19:45:05 +0100 edited question Base macro transfering text from Word Doc to Textbox

Base macro transferring text from Word Doc to Textbox Recently the question was asked How do I open a Word document from

2017-08-10 11:03:16 +0100 asked a question Base macro transfering text from Word Doc to Textbox

Base macro transferring text from Word Doc to Textbox Recently the question was asked How do I open a Word document from

2017-08-07 09:32:44 +0100 received badge  Notable Question (source)
2017-08-07 09:03:55 +0100 commented answer macro for highlighting sub-form row in Base

Now works perfectly! Thanks for your endurance.

2017-08-06 16:14:08 +0100 received badge  Commentator
2017-08-06 16:01:20 +0100 commented answer macro for highlighting sub-form row in Base

Placing the last two lines of code in your second solution to my previous question between the line oForm = ThisComponen

2017-08-05 12:42:38 +0100 commented answer macro for highlighting sub-form row in Base

Once again thank you for your help. The code runs perfectly and produces no errors. But testing it on a form of 3330 rec

2017-08-05 12:41:35 +0100 marked best answer macro for highlighting sub-form row in Base

Following my question what code do I need in a Base macro to access a field in highlighted row in a datasheet I received excellent code from Ratslinger which answered my question. I now have a further question based on that code.

I have altered the form 'Customers' so that it not only displays information about that customer but also contains a subform grid, In which details about all the items sent to that customer are displayed. This subform is based on a query into two tables, one listing all the items it is possible to send (with a primary key ItemsID ) and the other listing all the possible customers ( with the primary key CustID). I open the form by highlighting a particular postage in another form - say the postage of itemID = 5 (coffee) to CustID = 2 (Mr Smith). The form 'Customers' shows details about Mr Smith (his telephone numbers and addresses) and also in the subform the items he has been sent (row 1: cakes; row2: butter; row 3: coffee; row 4 milk).

All of this I have written and tested and it seems to work perfectly. When I highlight the row in 'Postage' the macro picks up the CustID and opens the form 'Customers' which contains also displays the Query showing the items this CustID received.

What I am trying to do is to modify the code further so that the row in the subform grid which says Mr Smith received coffee is highlighted. I want this highlighted because it was this that originated my search.

I think I need to do a couple of things:

First I must pick up the ItemID along with the CustID in GetCustID(). I presume this will be

oObj2 = oControl.getByName("itemID")

iItemID = oObj2.getCurrentValue() - where iItem is global.

Secondly I must highlight this item in the subform grid by modifying OpenFormAt Record().

Any help identifying the appropriate alterations would be much appreciated because I'm not making any progress:(

2017-08-03 01:12:43 +0100 received badge  Popular Question (source)
2017-08-02 15:58:50 +0100 edited question macro for highlighting sub-form row in Base

macro for highlighting sub-form row in Base Following my question what code do I need in a Base macro to access a field

2017-08-02 15:57:44 +0100 asked a question macro for highlighting sub-form row in Base

macro for highlighting sub-form row in Base Following my question what code do I need in a Base macro to access a field

2017-08-02 14:03:40 +0100 marked best answer what code do I need in a Base macro to access a field in highlighted row in a datasheet

Hi

Can someone knowledgeable in programming macros for Base help me?

I have a form (Form A) which displays data as a data-sheet. This form also contains a button. When this button is pressed it activates a macros which opens another form (Form B) in the databank. That bit I can do.

What I cannot do is this: I want first to highlight a row in the data-sheet of Form A by clicking the mouse onto the blank cell at the left-hand side of the chosen row, then when I press the button I want the macro not only to open the Form B but also to send data held in one of the fields of the highlighted row of Form A (the field contains primary key) to Form B.

More explicitly: The data-sheet in Form A contains a list of customers and their addresses, I select a particular customer from the data-sheet by clicking on it with the mouse. Base then highlights the row and marks it with a little green cursor (all done automatically - no macro required!) I then click on the press-button which activates the micro and this should open Form B which contains further details about the customer I marked in Form A such as what purchases he/she has made in the past. As my macro currently contains no code to pick up the data in the highlighted row, the wrong customer appears when Form B is opened.

If anyone can tell me the script that I need to do this I would be most grateful.

meakasteve

2017-08-02 14:03:40 +0100 commented answer what code do I need in a Base macro to access a field in highlighted row in a datasheet

Hi Ratslinger. If I have altered the form 'Customers' so that it also contains a subform grid, In this grid are listed a

2017-07-31 16:12:41 +0100 commented answer Base macro that opens a new/clean record in another form

Many thanks Ratslinger. Yes it was only a minor change but that testifies to the elegance of your original code!

2017-07-31 16:12:36 +0100 marked best answer Base macro that opens a new/clean record in another form

I have a form that lists customer's names and addresses in a grid. I can highlight a particular row, press a button on the form and another form opens up displaying a lot more details about that customer. Both the first form (with the button) and the second (with the details) are based on the same table. The macro which achieves this and is attached to the first form is based on Ratslinger's solution to my question "what code do I need in a Base macro to access a field in highlighted row in a datasheet" from Oct. 14 2016. His solution captures the primary key associated with the customer highlighted in the first form and uses it to display in the second form the data relevant to that customer.

I am now struggling with writing a second macro which would be attached to a second button on the first form and would cause the second form to be opened (irrespective of which row is highlighted in the first form) at a new record. I could then enter details about a new customer on this second table and when this second form is closed this data would be stored in the table (and be displayed in the list of the customer names and addresses in the grid of the first form).

Basically I want a macro that opens up a new/clean record in second form in which data can be entered and which automatically stores the autovalue of the new primary key number for the table. The nearest reference to this problem I have found on the internet is https://forum.openoffice.org/en/forum.... But it has so far not helped me. If anyone in the the community can help me I would be most grateful.

2017-07-31 07:57:42 +0100 received badge  Popular Question (source)
2017-07-30 16:48:26 +0100 asked a question Base macro that opens a new/clean record in another form

Base macro that opens a new/clean record in another form I have a form that lists customer's names and addresses in a gr

2017-07-30 15:36:18 +0100 marked best answer Problems with OpenFormAtRecord()

I would be grateful for any help the community can give me solving the problem I outline below.

On October 4th 2016 I asked the question on this LibreOffice Forum “what code do I need in a Base macro to access a field in highlighted row in a datasheet.” The answer that I received (from Ratslinger) worked perfectly. The code is shown in Listings A below.

I am now trying to modify this code to deal with a slightly different situation. In the original code the iCustID is obtained from a form (form #1). Specifically it is obtained from a grid in the MainForm of this form (which has a listing of customers and the iCustID corresponds to the customer on the row highlighted with the mouse). The selected iCustID is then used in a second form (form #2) which displays not only information about the customer but also information about the history of that customer's contacts contained in a sub-form grid on this second form.

What I am now trying to do is to mark a particular contact by the customer on the subform grid of the form #2 and on pressing a button take that primary key of this contact, iCustConID, and open a third form (form #3) that shows details about this contact as well as containing a sub-form grid which contains fields from a list giving information about what happened on this particular contact. To accomplish this I have modified the code so that it looks into the subform rather than the mainform for the ID number but have left everything else the same. The modifications are shown as ** in Listings B below: As can be seen the only subroutine that I believe needs modifying is the first one, Sub GetID().

Unfortunately the code does not work. It runs well until entering the sub OpenFormAtRecord then fails. Up till that point it has correctly identified the value for iCustConID but instead of opening the form#3 with the correct data for iCustConID it opens the form#3 displaying the data associated with the lowest iCustConID value in the table. In other words the iCustConID value gets lost and the lowest value becomes the default.

I think my problem is that I do not understand properly how the Sub OpenFormAt Record() works as well as whether the last three lines in sub FormChange need modifying or initiating.

Can anyone help me?

Listings A

  'Option Explicit 
  Global iCustID as Integer

  Sub GetID()       'Attached to Button on first form 
  Dim oForm As Object
  Dim oControl As Object
  Dim oObj1 As Object
  oForm = ThisComponent.Drawpage.Forms.getByName("MainForm")
 'Get the grid control
  oControl = oForm.getByName("MainForm_Grid") 
  oObj1 = oControl.getByName("CUSTID")  'Get the column with the ID info needed 
  iCustID = oObj1.getCurrentValue()  'Save current selection in a global variable
  'This next line calls routine to close current form and open another with a name of CUSTDATA

  FormChange("CUSTDATA")
  End Sub   

  SUB FormChange( sFormName )  'Used to close old form and open ...
(more)