Ask Your Question
1

Open query or table from a button

asked 2016-01-30 09:11:42 +0100

spiralfj gravatar image

When I made a button in form to open form or report, ThisDatabaseDocument.FormDocuments.getByName("Form1").open() ThisDatabaseDocument.ReportDocuments.getByName("Report1").open()

But I can't open query or table same way. How can I do to open query or table from a button?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
2

answered 2016-02-02 12:05:55 +0100

pierre-yves samyn gravatar image

updated 2016-02-03 18:13:26 +0100

Hi

The simple solution is of course to base a form on the table/query...

It may nevertheless be directly open table/query as in the OpenTableQuery.odb attached.

I only use a single procedure for both: I test the name of the button to choose between the table and the query.

note: my source was here.

As Drew said not sure this is THE final answer - but it works

[EDIT]

If you want to open a query in design view to give parameters, my suggest is to use a form for parameters input, then update the query as in this FR.MACROS_Base_003_RapportParam.odb

Regards

edit flag offensive delete link more

Comments

Thanks very much. I tried that Drew's source before but my skills and English is not enough, I failed. Now, I checked OpenTableQuery.odb, It worked.

But there’s just one more thing I need to know. I'd like to open query and type words in criterion each time, so is there any way to open query design view from a button?

spiralfj gravatar imagespiralfj ( 2016-02-02 16:21:55 +0100 )edit

That update-query method worked. Thank you very much for your help.

spiralfj gravatar imagespiralfj ( 2016-02-05 08:46:12 +0100 )edit

Hi @pierre-yves samyn, I tried running your file but when I click the report button on the form I get the error that the types don"t match in the code for the Macro.

cleo27 gravatar imagecleo27 ( 2017-06-20 23:59:54 +0100 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2016-01-28 18:47:54 +0100

Seen: 695 times

Last updated: Feb 03 '16