Join our community by registering and logging in.
As a member, you'll get access to exclusive forums, resources, and content available only to registered users.
John,
what type of object are you using?
The sentence in "Default value SQL" field is valuated to populate a field only when you insert a new record: when you open an exixting record this SQL is ignored.
The hash variable #recordID# is the id of the current record, but when inserting a new record this is always '-1'.
Sorry, forgot some details...
It is in a subform i try to put a default value which is based on a SELECT statement including the main form's recordID. So the ID exist, and the rows in the subform are new records. So in theory it should work. I will put up some practical examples.
John
Oh, then I am a bit confused. Because I successfully use #recordID# in the SQL statement for the dropdown, and then it definitely takes the id of the main record. But in the Default SQL it apparently uses the id of the subform record.
John
Here is the example where I use the same select statement to populate the dropdown, and then just limit to 1 to always default to the first value in the list, but it does not work the way I expected. In the dropdown statement it uses the main record's id, but in the default it uses the id of the sub-row, which is always -1 since it is only used on new rows.
So I made something like this instead and call it on nuLoadThis
function defaultCurr(vsubform,curr) {
var sub_row = Array();
sub_row = nuSubformRowArray(vsubform);
for(var i = 0 ; i < sub_row.length; i++) {
var vfield=document.getElementById(sub_row[i]+'ii_currencies_id');
//if value is not set, put a default value
if (vfield.value=='') {
vfield.value = curr;
}
}
}
You do not have the required permissions to view the files attached to this post.