Page 1 of 1

List the records in a subform through an autonumber field

Posted: Thu Jan 26, 2023 12:49 am
by cuadradoja
Hello...

I'd like to know how I can list the records in a subform through an autonumber field. I've tried to do it in the same way as in a main form, but it doesn't work for me. I'm really interested in learning how to use this powerful tool, but sometimes it's a bit complicated for me since I've been working with MS Access databases.

I would really appreciate if someone can help me on this particular issue.

Jose

Re: List the records in a subform through an autonumber field

Posted: Thu Jan 26, 2023 6:35 am
by kev1n
Hi Jose

I'm afraid AUTO_INCREMENT is not supported in subforms (unless it's readonly)

Re: List the records in a subform through an autonumber field

Posted: Thu Jan 26, 2023 11:18 am
by cuadradoja
Hello Kevin

I am very grateful for your answer, I had been trying to do an AUTO_INCREMENT in this type of object for some time, but now I have it clear.

I want to ask you another question... How can I make data from a main form copy to a specific field of a subform?

...and thank you very much for your willingness to help me!!!

Re: List the records in a subform through an autonumber field

Posted: Thu Jan 26, 2023 12:02 pm
by kev1n
Example:

Code: Select all

// Set a cell value. If row not specified -> last row
// id: subform object id
// column: object id
// value to set
// row number

function subformSetValue(id, column, value, row) {
    if (row === undefined) {
        var r = nuSubformObject(id).rows.length - 1;
    } else {
        var r = row;
    }
    $('#' + id + nuPad3(r) + column).val(value).change();
}

// Example:
subformSetValue('your_subform_id', 'subform_column_id', object_id_on_main_form.value, 1);
PS:

It is generally not recommended to ask multiple questions in one topic because it can make it difficult for other users to understand what you are asking and to provide specific and relevant answers. Additionally, it can also make it difficult for others to follow the conversation and contribute to the discussion. It's best to create separate threads for each question, with a clear and specific title. This will help others understand what you are asking and provide better answers.

Re: List the records in a subform through an autonumber field

Posted: Thu Jan 26, 2023 3:07 pm
by cuadradoja
Ok, I got it... anyway, thank you very much for the clarification and for the code. I'm going to run it in my application to see if it works for me and I'll let you know.

Regards...