473,406 Members | 2,633 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

How to be sure that the recordsets of two different forms are the same?

41 32bit
I have two different forms that uses the same query as data origin, but sometimes the filters are changed and other times I have to resyncronize the informations.
The requery procedure takes so long and if the forms already have the same recordset, I don't have to spend that time.
Is there any way to be sure that the recordset of Form1 is exactly the same as the recordset of Form2? I mean: Any tag or checksum or special function or something like this that could say that two recordsets are identical before a require procedure?

Best regards
Ricardo de Milano
Dec 30 '15 #1
12 1424
zmbd
5,501 Expert Mod 4TB
+ You can use a custom event between forms to trigger a requery; however, what I suggest is that you either look at code to alter the filter dynamically instead of using two separate forms for the same data, or look at recreating the form using a tabbed control instead of dual forms.

Custom events can be fussy to work with, the dynamic filters are straight forward to implement, and the tabbed control is the next easiest method.

+ Any particular reason behind the two separate forms.?
Dec 30 '15 #2
NeoPa
32,556 Expert Mod 16PB
I typically create the SQL for the recordset first. Once that's done I compare this with the form's .Recordset property. If they're the same I do no more. If they're different I set .Recordset from the string I worked out.

I don't understand what you're asking about as I see no scenario where matching two forms makes sense, and if it did there's nothing in your question to indicate which should be considered the master, or correct. Once you know that though, you'd simply compare the other with the master and apply it only if it were different. Very much as you would normally when it comes to applying a .Recordset that you've worked out to be what's required.
Dec 30 '15 #3
hvsummer
215 128KB
I think we can call
Expand|Select|Wrap|Line Numbers
  1. somevar = Forms!FormName.filter
  2. Me.filter = Somevar
if that problem come from filter

but I think you should create new recordset from your query SQL then bind recordset to those 2 form as NeoPa suggestion
Dec 31 '15 #4
zmbd
5,501 Expert Mod 4TB
hvsummer but I think you should create new recordset from your query SQL then bind recordset to those 2 form as NeoPa suggestion
That is not what Neopa suggested.


hvsummer I think we can call
Expand|Select|Wrap|Line Numbers
  1. somevar = Forms!FormName.filter
  2. Me.filter = Somevar
if that problem come from filter
that however doesn't satisfy OP's question, it only compares the filters applied and OP clearly states that the forms may have different filters while based on the same record-set.

The problem apparently arising if the record set is altered in one form then needs to be updated in the second form along with the difference in filters; however, this is just a guess on my part as OP has not provided that information.

As NeoPa indicates, and as I have alluded to, this scenario doesn't make sense and we need more information from OP in order to provide a much clearer course of action.
Dec 31 '15 #5
hvsummer
215 128KB
@zmbd:
I have two different forms that uses the same query as data origin, but sometimes the filters are changed and other times I have to resyncronize the informations.
The requery procedure takes so long and if the forms already have the same recordset, I don't have to spend that time.
Is there any way to be sure that the recordset of Form1 is exactly the same as the recordset of Form2? I mean: Any tag or checksum or special function or something like this that could say that two recordsets are identical before a require procedure?
when I read this, I tho that everyone could know that he need to synchronize record between 2 form.
we can say he need to make sure 2 record that currently show up in form is the same.

there are 2 problem could occur here:

First, if he only want to make sure 2 form have same filter, same order, same currently row.

Solution for this is make a form with subform, link 2 form together in the same screen.

Second, if he want to make sure the currently record are the same, no matter filter, no matter order, don't even care about filter.

Then we just need to ask him what is the unique ID value field on his query, and use any method to save that value in somewhere (table, collection, dictionary) in afterupdate_event of the Unique_ID value field. after that, Recall/show that Unique_ID in 2 table at the sametime
--> this method somewhat similar to Me.recordset = rs.Open(SQL) but I did not test the result to see whether it's the same way or not.

I don't know if my Idea is good or not, but, I'm sure that my predict have veryhigh strike rate.
Dec 31 '15 #6
NeoPa
32,556 Expert Mod 16PB
Ricardo de Milano:
Is there any way to be sure that the recordset of Form1 is exactly the same as the recordset of Form2?
This is an interesting question in as much as the intention isn't clear.
Ricardo de Milano:
Is there any way to be sure that Form1.Recordset is exactly the same as Form2.Recordset?
Like this, we are clearly talking about one specific property. This is how I interpreted the question when I posted.
Ricardo de Milano:
Is there any way to be sure that the eventual resultant recordset of Form1 is exactly the same as the eventual resultant recordset of Form2?
Like this, we're interested in what is shown in the form regardless of which properties were used to get to this result. This may, or may not, even include sorting.

While we are all reading the same words, it may be that we're interpreting them differently. This is one of the drawbacks of having a responsive and popular forum where only English is used. Of course, allowing other languages is a whole different ballgame and I'm not suggesting that. Simply that working in other languages can be difficult for both members asking questions and those answering them.
Dec 31 '15 #7
Ricardo de Mila
41 32bit
I really should have to had asked this to you before. I feel you are totally right. But now I will have a lot of work to correct my mistake. The tabbed controle would save me a lot of time.
Thank you Zmbd.
Jan 2 '16 #8
Ricardo de Mila
41 32bit
Dear NeoPa... About the scenario that has originated by problem, please, keep in mind that there are a lot of information to be showed in just one form, so I have divided the showing in 5 forms. This causes some problems with sincronization and I was wondering if there is any "magic" function to say that two recordsets are exactly the same. I'm not sure if I understood what you mean about comparing both recordset.. Are you stating something like

if RS1 = RS2 then dosomething

?

Thank you very much for answering and best regards.
Ricardo
Jan 2 '16 #9
Ricardo de Mila
41 32bit
Hello everybody...
I'm not sure I'm making a basic mistake, but here is my detailed problem and the concepts I have in my mind to originate the question:
I have a specific form FRMa00 with the field FLD1.
I have two other forms that are FRMb00 and FRMb01. The recordset for both FRMb00 and FRMb01 are the same there's a field FLD2 in this recordset. The filter is FLD2=FRMa00.FLD1.
If I change the record in FRMa00, I have to requery FRMb00 to update the information. The recordsource is the same and the Filter is the same, but I have to FRMb00.Requery.
In some cases, even requerying FRMb00, the recordset in FRMb01 will not change just due to a coincidence.
The question is: Is there any way to be sure that the recordset of FRMb01 (that has been already requeryed) is the same as FRMb01's recordset that was not requeryed?

Best regards
Ricardo
Jan 2 '16 #10
zmbd
5,501 Expert Mod 4TB
Ricardo,
I was going to split this last post from the thread as a new question; however, after a very careful read, it appears to be the exact same question as your first post, just a little more detailed...

Therefor, the same answers to the dilemma will still apply

My second thought here is to merge your last post with the first... can you help me out here?
Jan 2 '16 #11
zmbd
5,501 Expert Mod 4TB
The tabbed controle would save me a lot of time.
You might find the following articles to be helpful:
) Using Tabbed Pages on a Form
) Accessing Tabs on a Tab Control

IN this particular case, you might want to avoid the subform approach within the tabbed control.
Jan 2 '16 #12
NeoPa
32,556 Expert Mod 16PB
Hi Ricardo.

The word 'recordset' has two meanings.
  1. .Recordset is the name of a property that can be found on Form and Report objects. Comparing this with another .Recordset property would be comparing two strings for equivalence.
  2. Recordset is also a word that refers to items that are found in such objects, but are also found elsewhere. Although these can be described using table names, query names and SQL strings, the word actually refers to the resultant set of records. These can be considered the same even when the the strings defining them are not.

    An example for that is :
    Expand|Select|Wrap|Line Numbers
    1. [TableName]
    &
    Expand|Select|Wrap|Line Numbers
    1. SELECT *
    2. FROM   [TableName]
You can see from the above example that these two recordsets would be considered to be the same when treating the word as in point #2, but not the same when treating the word as in point #1. This is why different experts have given different, and apparently contradictory, advice. If we knew which term you were thinking of when you asked the question it would be helpful.
Jan 3 '16 #13

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: sans_spam | last post by:
I want to pull 2 different recordsets using 2 different stored procedures using the same Data Connection. Below is the code that I currently have, but I'm getting an 'Object Required' error...
0
by: Bamse | last post by:
Hi, I want to synchronize (the Master-Details concept) 2 grids in 2 different forms by using BindingContext. is this possible?
1
by: bearmstrong | last post by:
Here's what i need to do, keep in mind that I'm new to access and have learned coding is the same as excel. I have 2 different types of users, those that are users and those that are admin. I have...
5
by: djhexx | last post by:
Hi. We have an asp.net intranet application written in VB that uses forms authentication for all it's pages. I have a C# asp.net application that I just wrote. The company would like the C#...
1
by: saqib01 | last post by:
Please help me in knowing that how can I add values from different forms, i mean i want to add values from form1 and form2 and show the result in form 3
1
by: erri | last post by:
Is there a way to split the contents of one table into different forms (i.e. subform1 = LastName A-F, subform2 = LastName F-M, etc) without having to make queries?
1
by: Skarthi | last post by:
i write a oracle stored procedure in login screen.. its two different type of login employee and employer...in front end assign the procedure in class file... how to call different forms my...
2
cindy2
by: cindy2 | last post by:
Hi everybody, In my vb2005-project I have a subprocedure (in a MODULE) like this: Public Sub MakeInputArray() Input(0) = Form2.TextBox1.Text Input(1) = Form2.TextBox2.Text End Sub...
3
by: Zabooster | last post by:
Hi all, I have to submit a project in 2 days' time and am currently challenged trying to send information inputted into textboxes, radiobuttons and checkboxes present in different forms to a sigle...
20
by: slenish | last post by:
Hello, I am having a problem with a query attatched to a report. I have two different forms that I want to be able to run the same report with. Example: Form(A) is open I input a date range in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.