The application I'm writing has a main form where all the database fields and DBGrid that contains the entire SQLite dataset (ExpItemQuery) reside. I have designed a database search functionality into the application using a separate Delphi form. The search form can find records based on a number of fields (project ID, dates, vendor, etc.). The search results are shown in a DBGrid using a different dataset query (SearchQuery) of the same main database records as the main form.
The problem I struggling with is how once the user selects the correct record from the Search Form can I bring it back to the main form, select the correct record to display on the main form. To make matters a bit more challenging, each of these datasets will have the same content (fields) from the database, but the record count and numbers will be completely different, so using them to locate the proper record won't work. I have looked into using the CopyRecord method of TFDQuery however, there is little to no documentation or examples to follow so I'm not sure its appropriate. I have also looked at similar methods GotoCurrent and CloneCurosr which I don't believe will work properly given the differences in the main form dataset and the subset dataset.
The only potential solution I can reasonably come up with is to copy the SearchQuery record information as selected by the user into a memory storage record, close the search form, search the main form dataset for the correct record using several key fields and display it.
I'm hoping that someone has a better solution to this problem that I've may have overlooked.