Ask Your Question
0

Can't run Access2Base syntax

asked 2016-08-26 06:10:58 +0100

padricLibre gravatar image

updated 2016-08-26 06:28:03 +0100

I have followed every thing I can find but can't run a simple command.

Sub openform

OpenForm ("GroupLkUpF") end sub

EDIT: code input option (101010) didn't work.

I get several

Code from Access2Basic site REM Open a form ... OpenForm("myForm")

I renamed form to match as shown in form selection window, no longer MainForm. When I added the OpenDB (MyOpenDB in my db) code in the tools/events as directed on Access2Basic site. It tells me I can't connect. Luckily I have backups ! I even tried to add a push button to a form in the TT Northwiwnd tutorial DB and it wouldn't run there either. Variable not set. I would like to do more than basic forms in LO. Without the simple "OpenForm" I can't even make a simple switchboard !! What am I doing wrong ? Must be something in my configuration...

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
1

answered 2016-08-26 07:06:25 +0100

Ratslinger gravatar image

Been putting off learning Access2Base. Did a lot of access work many years ago. Threw together this sample when I saw your post. Open Form1 and try the buttons.

SampleAccess.odb

edit flag offensive delete link more

Comments

Possibly part of the problem is the mixing of Access and Base meanings. I only realized this when I tried your syntax. In Access a Form is a document not a section in a form - yet another reason I dis-like the terms form and subform in a Base form.

Ratslinger gravatar imageRatslinger ( 2016-08-26 07:19:40 +0100 )edit

Thanks, I see you have 9 Const statements in the macro. Does that mean I would need to have those in every "OpenForm" macro and need to do the same for other "Access" commands like DoCmd., etc.?

padricLibre gravatar imagepadricLibre ( 2016-08-26 11:30:17 +0100 )edit

I found those Const statements on the A2B site. I guess I could include any needed Const statements within the OpenDB module and that would make them available throughout the db. Am I correct ?

padricLibre gravatar imagepadricLibre ( 2016-08-26 11:43:32 +0100 )edit

I'm thinking I might have answered my own question. If so, its going to require a massive OpenDB module to write in Access type code. Maybe I should learn the native language ! If so, what is it and how to I find it ? While trying this I tried a "oForm" syntax and it didn't work either. Am I just spinning in circles here ?

padricLibre gravatar imagepadricLibre ( 2016-08-26 11:49:30 +0100 )edit

@padricLibre a Const is nothing more than an easy way to use a specific value and make things easier to remember. When first starting in LO macros I thought Access2Base may be the way to go since I had Access background. That was about 2 years ago and I'm just starting to play with it. Learning the native Basic and a little UNO was the way I chose. I found 99% of my questions were already answered in forums and manuals. Each person is different - choose a direction & stick with it.

Ratslinger gravatar imageRatslinger ( 2016-08-26 16:42:37 +0100 )edit

I'm kind of in the same boat. Think I'll be giving the native LO method a try, Thanks for the help.

padricLibre gravatar imagepadricLibre ( 2016-08-26 17:36:38 +0100 )edit
0

answered 2016-08-26 13:03:25 +0100

peterwt gravatar image

I think your last comment is the best route for using macros in Base - learn the Base language supplied with LO.
The documentation on LO is not comprehensive. This site here has some good information on Basic used in LO.
Download the document OpenOffice.org Macros Explained.pdf.

I have added to the example provided by @Ratslinger. Form3 opens Form2 just using LO Basic not requiring Access2Base.
SampleAccessMod.odb

edit flag offensive delete link more

Comments

Thanks, I'll be giving that a try as well. Looks like it would be a better way to go. Got a lot of reading to do. Looks like using A2B requires a lot of additional code. Makes me wonder why they say A2B is included with LO. Wouldn't be so bad except Base error trapping seems to cause fatal errors way to often. Not a good learning environment! Backup, backup, backup seems to be the word of the day for using Base.

padricLibre gravatar imagepadricLibre ( 2016-08-26 13:34:29 +0100 )edit

@answered, Worked like a charm. Thanks. Off to see the wizard, so to speak. Gotta see whats behind the curtain !

padricLibre gravatar imagepadricLibre ( 2016-08-26 18:07:41 +0100 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2016-08-26 06:10:58 +0100

Seen: 190 times

Last updated: Aug 26 '16