Topic: Update records in database from different forms

Hello All at MVD,

This question probably has been explained in numerous ocassions but I've searched the forum looking for something to solve
my problem and frankly didn't find it.  I have a multiple tables and several forms.  In the main form, I show a grid that displays
an employee database with different fields, idnumber, name, department, ss#, hiring date.  I have  a button to add new records,
in this form, you add the information that will appear on the grid with the corresponding fields.  I want to add another button to this
form ( the new record form ) that will open up another form to enter additional actions to be taken on that particular employee,
i.e.  vacation, leave of absence, medical leave, destitution, etc.  This new form will have two combo boxes that display values to be
chosen, memo field, and other things.  What I want to do is to bring the information I have from form1 (New record form) and display it on this second form (Actions Form)
plus save the new information from the combo boxes and memo fields , all in the same record in the database. Is this possible?  Please help!!
Thanks.

Re: Update records in database from different forms

HELLLP!! PLEASEEEEE sad sad sad

Re: Update records in database from different forms

Hello Gonpublic,
What you've described is certainly possible in MVD.
However, without knowing more about your project, your database design and the process flow, it's difficult to suggest options. 
My initial question is why you need the split across two forms if the additional actions information is to be saved to the same record (or is the additional actions information being stored in a related, one:many table)?
Could you attach a copy of your project?  That would help a lot.
Derek.

4 (edited by gonpublic2012 2017-03-05 18:35:48)

Re: Update records in database from different forms

derek wrote:

Hello Gonpublic,
What you've described is certainly possible in MVD.
However, without knowing more about your project, your database design and the process flow, it's difficult to suggest options. 
My initial question is why you need the split across two forms if the additional actions information is to be saved to the same record (or is the additional actions information being stored in a related, one:many table)?
Could you attach a copy of your project?  That would help a lot.
Derek.

Thanks Derek,  I actually solved the problem by eliminating the emerging form (form 2 ) and just putting everything on Form1, creating two extra tables (action, status) and referecing them as dictionaries to the main table.  Works fine.  However, I have another question related to this, can I use 1 save button to save records on 2 different tables?  the first table will be for the records themselves, the second table being a kind of log for actions that had taken on a particular employee.  Sort of to look for a history of actions to display on a grid.  Sounds complicated?

Re: Update records in database from different forms

can i see u'r emplyee project for taking an idea me too i am working on that project and it is verry complicate

Re: Update records in database from different forms

Hi Gonpublic,
Are you meaning like some sort of audit log?
In my attached example, when I go into the relevant form, I hold the existing 'name' and then check to see if any changes are made to the 'name' field.  If yes, I save both the old and new values together with a date/time stamp into an audit table which I can  then view to see a history of changes.  In my example, I've decided that I'm not interested in tracking any other changes, but obviously you can decide what is and isn't important to you.  And to help the user, I add a counter to show which rows of data have had changes to any field that is being audited.  Just click on the 'Audit Log' button to toggle the audit panel on and off.
I couldn't think of any different approach to take and it could do other things like getting the name of the user who makes the change etc etc, but hopefully it gives you an idea.
You can't use one button to save records in two discrete tables.  But what you can do is to attach an 'on after click' action to the first button that then, in a script, automatically clicks the second button (I'm actually doing it in the attached example);  hide the second button and the effect is that one button saves both records.
Derek.

Post's attachments

Attachment icon gonpublicaudit.zip 339.25 kb, 625 downloads since 2017-03-06 

Re: Update records in database from different forms

derek wrote:

Hi Gonpublic,
Are you meaning like some sort of audit log?
In my attached example, when I go into the relevant form, I hold the existing 'name' and then check to see if any changes are made to the 'name' field.  If yes, I save both the old and new values together with a date/time stamp into an audit table which I can  then view to see a history of changes.  In my example, I've decided that I'm not interested in tracking any other changes, but obviously you can decide what is and isn't important to you.  And to help the user, I add a counter to show which rows of data have had changes to any field that is being audited.  Just click on the 'Audit Log' button to toggle the audit panel on and off.
I couldn't think of any different approach to take and it could do other things like getting the name of the user who makes the change etc etc, but hopefully it gives you an idea.
You can't use one button to save records in two discrete tables.  But what you can do is to attach an 'on after click' action to the first button that then, in a script, automatically clicks the second button (I'm actually doing it in the attached example);  hide the second button and the effect is that one button saves both records.
Derek.

Thank you so much Derek, will try  it out.  @Zahar2002 , yes it has been complicated but thanks to this great forum I'tve found really great answers and help.  I'll return the fatvor and post the whole project once is finished.

8 (edited by zahar2002 2017-03-06 19:48:15)

Re: Update records in database from different forms

Thank you gonpublic2k i'll post mine when it finiched too its rich with examples thank'x too fto this forum and his admin and members.