Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

.RecordsetClone from a form bound to different table 1

Status
Not open for further replies.

Gumbo78

Programmer
Feb 17, 2004
20
US
I usually use this method to search a record. I use the logic below except for the

Set cp = Order.RecordsetClone
is usually
Set cp = Me.RecordsetClone

The form I am searching from is bound to the Customer table. The value I need to search is in the Order table.
This is what I have currently:

dim cp as DAO.Recordset
Set cp = Order.RecordsetClone

cp.FindFirst "Order_ID = " & [cborderid].Value
If cp.NoMatch Then
(enter order logic)
Else
msgbox "DUPLICATE"
End If

cp.Close


The lines in green are there for explination but are not actual code, just trying to lesson the spam and only have the parts I'm trying to correct. I am trying to get a RecordsetClone of the Order table. Anyone know a way I can do this? I have never had to search for a value that was in a different table than my form was bound to when wanting to use the .RecordsetClone method. Many thanks

-G78
 
Try this instead:

Set cp = CurrentDB.OpenRecordset("Order")
 
I tried that but it won't let me use the .FindFirst or .NoMatch features. It tells me object required. Also tried to do
Set rs = CurrentDB.OpenRecordset("Order")
with rs
cp = .clone
end with

and a few other things I tried with crazy syntax but I still cant get it to work.

 
Operation is not supported for this type of object is the exact error it gives.
 
You've opened a dao recordset alredy, no need for any cloning:

[tt]dim rs as DAO.Recordset
Set rs = CurrentDB.OpenRecordset("Order")
rs.FindFirst "Order_ID = " & [cborderid].Value
If rs.NoMatch Then
(enter order logic)
Else
msgbox "DUPLICATE"
End If[/tt]

Roy-Vidar
 
I usually like to make a dup just so I'm not messing with my real recordset. When I try use'n the recordset as is that way Mr. Roy I get the error:
Run-time error '3251':
Operation is not supported for this type of object.

and highlights the line:
rs.FindFirst "Order_ID = " & [cborderid].Value
It's use'n the same DAO.Recordset varible type as if I where doing it from the Customer table dataset so I have no idea. Any thoughts? Thanks

-G78
 
Should have thought of that, try opening it with the adOpenDynamic or dbOpenDynamic keyword (don't remember which).

[tt]CurrentDB.OpenRecordset("Order", adOpenDynamic)[/tt]

Roy-Vidar
 
Strange thing, indeed!

1) Check if you have accidentally double-Dimmed "rs".
Do you have any global variable with the same name or so?

2) Does "DAO" appear as choice after "as" in variable dimensioning? If not, you're simply missing a reference.

From your code above, nothing seems irregular to me...
:cool:

Andreas Galambos
EDP / Technical Support Specialist
(andreas.galambos@bowneglobal.de)
HP:
 
Opening the recordset as Dynamic works! Thanks!!

-G78
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top