Pergunte aqui

Perfil de allanoptical - atividade

2015-06-21 19:41:35 +0100 Medalha recebida  Pergunta famosa (fonte)
2015-01-21 15:26:25 +0100 Medalha recebida  Pergunta favorita (fonte)
2014-09-28 21:13:27 +0100 Medalha recebida  Pergunta famosa (fonte)
2014-08-19 18:49:04 +0100 Medalha recebida  Pergunta famosa (fonte)
2014-08-11 10:28:54 +0100 Medalha recebida  Pergunta notável (fonte)
2014-07-12 11:32:15 +0100 Medalha recebida  Pergunta popular (fonte)
2014-07-08 10:19:33 +0100 Perguntou problem running SQL from Basic

Last month I asked how run an SQL file in Base and was given a very effective code segment that was a an effective solution.

The code runs perfectly when called from the Macro menu.

However I now would like to call it from a button. I have an empty form with just one button on it (others will follow) which has the subroutine attached to its "Pressed" event.

The code contains this snippet.

if IsNull(ThisComponent.CurrentController.ActiveConnection) then

 ThisComponent.CurrentController.connect

endif

When I run from the Macro menu, or single step from the Basic editor everything is fine.

When I run from the button the code runs as far as the snippet above and then gibe the error message BASIC runtime error.

"Property or method not found: ActiveConnection."

Any suggestions as to what I should do please?

2014-07-08 10:00:18 +0100 Medalha recebida  Pergunta notável (fonte)
2014-07-08 10:00:12 +0100 Respondeu uma pergunta How does the "SELECT INTO" work in Base

Many thanks, this does indeed work, exactly as I wanted it. I still find the syntax of SQL awkward and in this case, as in so many in my experience of coding, once I can am told the answer it is so obvious.

2014-07-08 09:47:02 +0100 Medalha recebida  Entusiasta
2014-07-08 01:16:41 +0100 Medalha recebida  Pergunta popular (fonte)
2014-07-07 09:10:31 +0100 Perguntou How does the "SELECT INTO" work in Base

On page 137 of the Base handbook there is reference to SELECT [INTO CACHED|TEMP|TEXT] "New+table"]

When I enter a line like SELECT * from "members" WHERE "memnum" >180 INTO TABLE "check" I get an error complaining about the INTO Token. What is the correct way to use this feature.

2014-06-28 22:38:26 +0100 Medalha recebida  Pergunta notável (fonte)
2014-06-10 19:10:25 +0100 Medalha recebida  Pergunta popular (fonte)
2014-06-09 18:09:05 +0100 Respondeu uma pergunta edit data in a Base query

Half a solution, if both indices for the tables are included in the query then the "table" can be edited and data changed. However when I try SQL it fails. The query is SELECT "members"."memnum", "members"."Renewalyear", "payments"."ID", "payments"."Daterenewed", "payments"."rep" FROM "payments", "members" WHERE "payments"."MemberNo" = "members"."memnum" AND "payments"."rep" = 'N'

but when I enter the following into the SQL dialogue

UPDATE "forupdate" SET "Renewalyear" = 2019

I get

1: Table not found in statement [UPDATE "forupdate"]

2014-06-09 14:02:10 +0100 Medalha recebida  Pergunta famosa (fonte)
2014-06-09 13:54:05 +0100 Perguntou edit data in a Base query

I have two tables linked by a common field. I can create a query with data from both tables and selected according to a simple criterion.

Is it now possible to edit the data in that query and for the edits to be "passed back" to the initial tables?

2014-06-08 11:58:10 +0100 Respondeu uma pergunta How do I run an SQL file in Base

Many thanks for the useful and prompt answer, it works!!!

There seem to be small differences in format requirements but I can live with these.

However I do think it would be nice if this could be provided as a standard feature.

Allan

2014-06-08 10:52:42 +0100 Medalha recebida  Pergunta notável (fonte)
2014-06-07 22:40:29 +0100 Medalha recebida  Pergunta popular (fonte)
2014-06-07 18:32:47 +0100 Perguntou How do I run an SQL file in Base

I want to run regularly SQL scripts which include UPDATE and other operations not permitted in Queries but which do work when I enter them in the "Run SQL" dialogue box. However I want to avoid having to paste into this box every time so how do I just run a saved file of SQL commands