UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> recordsetClone Open copy of Form    
 
   
rrarick
post Feb 9 2008, 06:57 PM
Post #1

UtterAccess Addict
Posts: 282
From: Colorado



I have a form1 and it's record set open in a tab control page. On another tab I have form with a button to open a copy of form1 so I am trying to use the recordset.Clone to open it. I cannot get the code to work. I am not sure I am doing this right. Any help much appreciated...thanks. Code is below.
CODE
Private Sub BtnResevation_Click()
On Error GoTo Err_BtnResevation_Click

    Dim rsclone As Object
    Dim stDocName As String
    Dim stLinkCriteria As String
    
    Set rsclone = Forms!FrmMainPartyEntryPopUp.Recordset.Clone

    stDocName = "FrmMainPartyEntryPopUp"
    stLinkCriteria = "[CustomerID] =" & Me.CustomerID
    
    DoCmd.OpenForm stDocName, , , stLinkCriteria
    
    rsclone.Close
    Set rsclone = Nothing

Exit_BtnResevation_Click:
    Exit Sub

Err_BtnResevation_Click:
    MsgBox Err.Description
    Resume Exit_BtnResevation_Click
    
End Sub
Go to the top of the page
 
+
ace
post Feb 9 2008, 07:50 PM
Post #2

UtterAccess VIP
Posts: 5,278
From: Upstate NY, USA



What happens when you run the code you have posted?
Does the from not open?

I don't see any reason to get the Recordsetclone invoved in
this unless what you are actually doing is trying to navigate
to a record in a form that is already open.
Go to the top of the page
 
+
rrarick
post Feb 9 2008, 07:58 PM
Post #3

UtterAccess Addict
Posts: 282
From: Colorado



Your are correct in that I am navigating to a from that is already open in another tab. The error I am getting is that it cannot find the "FrmMainPartyEntryPopUp"...the form I am trying to open to a specific record. I double checked the spelling etc.
Go to the top of the page
 
+
ace
post Feb 9 2008, 08:48 PM
Post #4

UtterAccess VIP
Posts: 5,278
From: Upstate NY, USA



What you need to do is use the FindFirst and Bookmark methods
of the recordsetclone of the form in the subform control.
Replace SubformControlName with the name of the subform control
on the tab page that contains the form you want to manipulate.

CODE
With Me.[color="blue"]SubformControlName[/color].Form.RecordsetClone

     .FindFirst "[CustomerID] =" & Me.CustomerID

     If Not .NoMatch Then

         Me.[color="blue"]SubformControlName[/color].Form.Bookmark = .Bookmark

     End If

End With


Edited by: ace on Sat Feb 9 20:49:06 EST 2008.
Go to the top of the page
 
+
rrarick
post Feb 9 2008, 09:08 PM
Post #5

UtterAccess Addict
Posts: 282
From: Colorado



I am not sure how this would open the form though. I don't want to move to the record of the open form on the tab. I want to open a a form which is a copy of the form on the tab.
Go to the top of the page
 
+
ace
post Feb 9 2008, 09:26 PM
Post #6

UtterAccess VIP
Posts: 5,278
From: Upstate NY, USA



Huh? Read your last two posts. They are in direct
contradiction with each other.
Go to the top of the page
 
+
rrarick
post Feb 9 2008, 09:45 PM
Post #7

UtterAccess Addict
Posts: 282
From: Colorado



I guess I did not use the right wording. Navigating to the other form was meant to mean opening up the copy form not moving to the open form on the tab. I am doing this popup kind of thing for quick ease of editing the record instead of navigating back to the open form on the tab. Sorry for the confusion.
Go to the top of the page
 
+
ace
post Feb 9 2008, 09:54 PM
Post #8

UtterAccess VIP
Posts: 5,278
From: Upstate NY, USA



Is "FrmMainPartyEntryPopUp" the correct spelling of the form?

Did you try using the wizard when you created the Command button?

I don't see any reason why the form would not open if you spell the
name correctly. And as I said all that recordsetclone code you have
in your original post isn't doing anything.

Can you post your .mdb file?
Go to the top of the page
 
+
rrarick
post Feb 9 2008, 10:18 PM
Post #9

UtterAccess Addict
Posts: 282
From: Colorado



My original code was with the wizard and it opened the form up fine except when I went to edit the record and save it I would get and error of to many tables open and freeze Access. So my thinking was I had to use the recordsetClone. I would post the DB but it is close to 20meg and paring it down would take some doing.
Go to the top of the page
 
+
ace
post Feb 9 2008, 10:44 PM
Post #10

UtterAccess VIP
Posts: 5,278
From: Upstate NY, USA



Too many tables open is a whole different problem.
I don't know the details off the top of my head.

Your best bet for help is to post a new question and explain
what is actually happening.
Go to the top of the page
 
+
rrarick
post Feb 9 2008, 11:07 PM
Post #11

UtterAccess Addict
Posts: 282
From: Colorado



Thanks for the help...much appreciated. I start another post.
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 18th May 2013 - 05:13 AM