Suntower
Posts: 225
|
| Posted: 04/22/2005, 12:55 PM |
|
In a record form...
From the Before_Execute_Insert event, I can't seem to figure out how to access the SQL string which actually inserts a row. The property is Cmd but I can't figure out how to address it without throwing an error that the object doesn't exist.
I would like to modify that string to suit so that the record is inserted with various defaults columns.
How do I address this thing?
Function SOHEADERS_DataSource_BeforeExecuteInsert()
TIA,
---JC
_________________
---On a campaign for more examples and better docs! |
 |
 |
Suntower
Posts: 225
|
| Posted: 04/22/2005, 3:11 PM |
|
Anyone?
Driving me insane-o!!!
---JC
_________________
---On a campaign for more examples and better docs! |
 |
 |
DonB
|
| Posted: 04/23/2005, 12:57 PM |
|
For what you are doing (assigning default values) I'd first attempt to
define those in the database itself. Assuming that's not possible, I'd
consider the Custom Insert property to set those values (note that you can
select expressions to provide the default values and these can be functions
you write, if these values are complex and/or calculated rather than mere
constants).
However, to to this in the event handler, the object reference will be
Eventcaller.Connection.Execute("Some SQL query") to perform some operation
directly.
To affect the query that will be executed by the form's INSERT, you need to
use the Before Build Select and modify the values of
Eventcaller.SQL and/or Eventcaller.Where
which are text strings that , together, are the actual INSERT statement that
will be executed. You can't set these properties in the Before Execute
event - that's too late, the query has already been built.
--
DonB
http://www.gotodon.com/ccbth
"Suntower" <Suntower@forum.codecharge> wrote in message
news:6426956951fbd2@news.codecharge.com...
> In a record form...
>
> From the Before_Execute_Insert event, I can't seem to figure out how to
access
> the SQL string which actually inserts a row. The property is Cmd but I
can't
> figure out how to address it without throwing an error that the object
doesn't
> exist.
>
> I would like to modify that string to suit so that the record is inserted
with
> various defaults columns.
>
> How do I address this thing?
>
> Function SOHEADERS_DataSource_BeforeExecuteInsert()
>
> TIA,
>
> ---JC
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
 |
Nicole
Posts: 586
|
| Posted: 04/25/2005, 2:09 AM |
|
Suntower,
Try to use
Form_name.Command.SQL
_________________
Regards,
Nicole |
 |
 |
Suntower
Posts: 225
|
| Posted: 04/26/2005, 11:09 AM |
|
Perfect.
This may betray my own ignorance/incompetence, but...
HOW DO YOU FIGURE THIS STUFF OUT? Trial and error?
Is there some sort of 'Object Browser' of which I am unaware? I admit to not being the sharpest tool in the shed, but it isn't obvious to me that the SQL property is a member of the FormName. Command class.
Any tips on learning how to reference various properties/methods?
---JC
Quote Nicole:
Suntower,
Try to use
Form_name.Command.SQL
_________________
---On a campaign for more examples and better docs! |
 |
 |
Nicole
Posts: 586
|
| Posted: 04/27/2005, 1:59 AM |
|
Suntower,
To find this code I looked at the generated page code to check the classes used to display form and update database data. After several trials I found the right code 
_________________
Regards,
Nicole |
 |
 |
|