Switching RecordsetsClone in multi-sourced form

st3ve

Registered User.
Local time
Today, 07:45
Joined
Jan 22, 2002
Messages
75
I make a selection on a form to choose the source of the data (ie I set the form's Record Source depending on the selection combo)- to one of three tables. I select this source then go to a combobox to choose a particular record.

I use the recordsetclone structure to pull through a particular record from my source table using this combobox dropdown list.
ie. in the after-update event I have:

Me.RecordsetClone.FindFirst "[RferenceNO] = '" & Me![Combo2] & "'"
Me.Bookmark = Me.RecordsetClone.Bookmark

My problem is this:

When I make my record selection, I seem to go to the correct table and to the correct record, but only get data back if the record is also in the 'original' table, not the newly selected one!

When requesting a record, I think I also need to change the source table that the recordsorceclone points at.

How do I do that, and where do I put the code?

Also I'd like the main table to be a read/write but only have 'read only' for the other two, if that's possible.

Thanks for your help.
 
Reset the RecordSetClone right after you set the RecordSet property of the form.


When you want the form to be read-only set the allowadditions, allowedits and allowdeletions properties of the form to False. (Set them to true when you want the user to be able to do these functions).
 
Thanks for the pointers

...Any chance you could give me some code to do this as I'm having problems understanding how RecordSetClone works. What I need is something like :

If cboChoiceSelect = Table1 then
RecordsetClone = "Table1"
else etc...
.. but I'm not sure of the syntax.
 
You can use the "Search" function of this site.

Search for RecordSetClone.

There are examples on how to set a recordset for ADO or DAO to equal the Recordsetclone of a Form.

Basic

ADO
Dim rst as ADO.RecordSet
Set rst=Me.RecordSetClone

DAO
Dim rst as DAO.RecordSet
Set rst=Me.RecordSetClone
 
ADO Recordset Clone - Type Mismatch

If you are using a forms recordset clone you must use DAO in MDB files.

The ADO syntax always gives a type mismatch error in 2002 and below.

Not sure whether this has been fixed in the latest release.

It works OK in ADP files.

Jon
 

Users who are viewing this thread

Back
Top Bottom