| Subject |
Re: Appending records |
| From |
Akshat Kapoor <akshat.kapoor@kapoorsons.in> |
| Date |
Tue, 26 Sep 2023 14:28:26 +0530 |
| Newsgroups |
dbase.getting-started |
Good Afternoon Rouke,
> this.EXPENSES2 = new QUERY(this)
> with (this.EXPENSES2)
> left = 20.0
> width = 7.0
> height = 1.0
> database = form.expenses1
> sql = "C:\Users\rouke.bakker\OneDrive - AsureQuality Limited\the_Linx\Expenses\Expenses.sql"
Warning :
I will not recommend using a onedrive folder with dbase. Issues have
been reported when using dbase with Onedrive, Google Drive, Dropbox etc.
And if there is simultaneous edit in two different locations. Onedrive
etc will not be syncing both. Only one of the changes will be saved.
> active = true
> endwith
>
> I want to access expenses.dbf to generate the next order number, then leave expenses.dbf again and append a new record to the database and replace field biolinc_on with the newly generated order number.
There is no limit (Never went beyond single digits so do not know for
sure) to the number of tables that can be opened in a form.
So like Expenses2 there can be many more tables open at the same time.
As Mattia has suggested you should use commands like
form.expenses2.rowset.beginappend()
This will change the rowset to append mode.
Then assign values like
form.expenses2.rowset.fields["abc"].value = "xyz"
And then save
form.expenses2.rowset.save()
Then you can add row to
form.biolinc.rowset.beginappend()
form.biolinc.rowset.fields["abc"].value = 123
form.biolinc.rowset.save()
Both tables are open and will remain open till you close them or close
the form.
You can have
form.expenses2.rowset.beginappend()
form.biolinc.rowset.beginappend()
form.biolinc.rowset.fields["abc"].value = 123
form.expenses2.rowset.fields["abc"].value = "xyz"
form.expenses2.rowset.save()
form.biolinc.rowset.save()
This will also not give errors. But I will not recommend this approach
as it is easy to loose track of changes. Nesting if any should be done
properly using First in Last Out approach.
I would recommend that you go through Ken's tutorial. It will help you
in getting used to change in style of programming. Pasting link for your
convenience
Ken's dBASE Page: http://www.goldenstag.net/dbase
The dUFLP: http://www.goldenstag.net/dbase/index.htm#duflp
dBASE Books: http://www.goldenstag.net/dbase/Books/dBASEBooks.htm
dBASE Tutorial: http://www.goldenstag.net/dbase/Tutorial/00_Preface.htm
dBASE Web Tutorial: http://www.goldenstag.net/dbase/WebTutorial/00_Menu.htm
dBASE DOS to Windows Tutorial:
http://www.goldenstag.net/dbase/DtoWTutorial/00_Menu.htm
Regards
Akshat
|
|