cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
kman42
Helper II
Helper II

Can't create new record on Edit Form

I have an edit form bound to a mysql database. I can edit records fine, but I can't create new records unless I display the id field and enter something. id is the key field in the table and is set to auto-increment. I set the required flag for the field to false and it still doesn't work unless I enter a number in the id field on the form. 

 

Ideally, I wouldn't even show the id field on the form and it would just be created and auto-incremented when the record gets inserted. What am I doing wrong?

 

Thanks!

3 REPLIES 3
v-monli-msft
Community Support
Community Support

Hi @kman42 ,

 

If you cannot create new record, did you encounter any error message while submitting a new record via edit form? 

 

You could add the id field to the edit form, then set its Visible property to false and then have a try.

 

Check if below thread has any information that might help:

https://powerusers.microsoft.com/t5/Expressions-and-Formulas/MySQL-ID-Field-required/td-p/242796

 

Regards,

Mona

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-monli-msft
Community Support
Community Support

 
Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

I'm still trying to create a workaround for this issue. I'm trying to set the default value for the id card to the parent value if the form is in edit mode and to the max value of the database field +1 if it is in new mode.

 

If(NotesForm.Mode=FormMode.New,Max('[notes]'.id)+1,ThisItem.id)

This results in:

The function Max has some invalid arguments. Invalid argument type (Table). Expecting a Number value instead. 

 

id is an integer.

 

Thanks!

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (1,741)