Hi Ian,

This is starting to get a bit cluttered so I've used blue for m
y
comments this time. See below.

On 30 March 2013 18:45, Ian Whitfield <whitfi...@telkomsa.net> wrote:

>  Thanks again Noel.
>
> Let's give this one more 'go-around'!!
>
>
> On 30/03/13 02:16, Marion & Noel Lodge wrote:
>
>  Hi Ian,
>
>  I would suggest that you check on the actual name of your form -
>
>   Open the Form in Edit mode
>  Right Click on any field
>  Choose Form
> Make sure the General tab is selected
>  Whatever is showing in the Name field is the name the system will look
> for
>  If it's showing something other than 'Story', then that is your problem
>  If not, then I don't know.
>  It's odd that the error message is saying 'StoryTable' rather than
> 'Story'
>
>
> OK - I guess you are right here!! My name of the new Form is "Story" NOT
> "StoryTable" (That's the name of the Table!!). So I changed that. I also
> checked on my Main Form that I call "Members" but the System seems to call
> it "MainForm" - so which is right?? Changing this however made no
> difference!!
> In the Form's General tab (as described in my last post), the Name shown
> there is what the system uses.  You can change this to anything you like,
> but whatever you make it will be the "official" name, and needs to be used
> whenever Macro code refers to that Form, (as in this instance where you
> want to open the Story Form).
>
>
>  You may need to set a breakpoint in Sub OpenStoryTable(oEvent AS Object)
> and then single step through the code to see exactly where it throws the
> error.  That may give you a clue as to what is happening.
>
>
> I'm afraid you are way ahead of me here - I've no idea how to do this!!
>
 Don't worry about this just now - you may not need it.

> 
>
> So - last of all can we look at your Macro again...* [My comments to the
> right of each line**]*
>
> Sub OpenStoryTable(oEvent AS Object) - - -* [Is it right to open the
> Table here or should it be the Form?]*
>
As with naming a Form, you can call a Sub anything you like.  The name
has no bearing on what happens inside the Sub, but it is better to have a
name that tells you what the Sub does.

I would suggest that you *not* change it now, but once you have got the
button working you could consider changing it to - OpenStoryForm(oEvent AS
Object).
In that case you will also need to edit the button on the Members Form so
that it calls OpenStoryForm(), not OpenStoryTable().

What this Sub does is pass the name "Story" to the OpenForm Sub which does
the opening.  Once the Form is opened, it then opens the "StoryTable"


      OpenForm("Story") - - -* [My Form is called "Story" but checking on
this shows an empty Name field??]*
I think we have found the problem!

If in the Story Form's General tab the Name is blank, then you need to
change it to "Story" to match the name given in this Sub.  This lines up
with the error message you got that said  "NoSuchElementException".  In
other words the system was looking for a Form named "Story", but in fact it
was named blank!

End Sub

 Sub OpenForm(FormName AS String) - - -   * [I have not changed anything
below this line - correct??]
*
Yes that's right.

      With ThisDatabaseDocument.currentcontroller
           If Not .isConnected Then
                .Connect
           End if

      End With
      ThisDatabaseDocument.FormDocuments.getByName(FormName).open

End Sub

 Thanks for the help

IanW
Pretoria RSA

I hope I haven't confused you with all this explanation.  To summarise, I
think if you change the Story Forms Name from blank to "Story", the button
will then work.

Let me know if you still have problems.

Noel



-- 

>

-- 
For unsubscribe instructions e-mail to: users+h...@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted

Reply via email to