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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

syncronize form problem

Status
Not open for further replies.

sdimaggio

Technical User
Jan 23, 2002
138
US
I am trying to syncronize two forms.

I have a button on form1 (frm_pricingprofile) which opens form2. I put the following code on form2.


Private Sub Form_Open(Cancel As Integer)
On Error Resume Next
Dim rs As Recordset
Set rs = Me.RecordsetClone
rs.FindFirst "approvalnumber =" & Forms!frm_pricingprofile!Text169
Me.Bookmark = rs.Bookmark
Set rs = Nothing
End Sub

I am getting an error which states "Method or data member not found" and the text "Text169" which appears in my code is highlighted.

Text169 = [Approval Number]

Where am I going wrong?
 
Hi, you might try this:

Set rs = Me.Recordset.Clone
rs.FindFirst "[approvalnumber] = '" & Forms![frm_pricing_profile].[text169] & "'"

Me.Bookmark = rs.Bookmark

Hope that helps
 
I did what you suggested, however I get an error that reads: Compile error! Method or data member not found.

The text ".findfirst" is highlighted.

Here is the code:

Private Sub Form_Open(Cancel As Integer)
On Error Resume Next
Dim rs As Recordset
Set rs = Me.Recordset.Clone
rs.FindFirst "[approvalnumber] = '" & Forms![frm_pricing_profile].[Text113] & "'"
Me.Bookmark = rs.Bookmark
Set rs = Nothing
End Sub

Any Suggestions.
 
Hi, try changing Dim rs As Recordset to :

Dim rs As Object


Below is a sample from one of my forms that works:

Private Sub CboCbls_AfterUpdate()
'Locates the record that matches CboCbls.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[Descr] = '" & Me![CboCbls] & "'"
Me.Bookmark = rs.Bookmark
End Sub

Also, you need to add a statement in the Form Current Sub like:

CboCbls = [Descr] - which syncronizes the control with the current record.


Hope that solves the problem, if not - it's a slow day at the office.
 
I changed it to Object, but I'm still having difficulty.

Private Sub Form_Open(Cancel As Integer)
On Error Resume Next
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[approvalnumber] = '" & Forms![frm_pricing_profile].[Text113] & "'"
Me.Bookmark = rs.Bookmark
End Sub

on the current event I have

Private Sub Form_Current()
[Approval Number] = [Text113]
End Sub

Any Suggestions?





 
Hi, I think I owe an apology for not reading the original question accurately. What I was talking about was syncronizing a control and data within the same form and you are interested in doing that between forms. I think what you really should be doing is opening the second form as a sububform of the first one, assuming there is a common field between both forms. You can create a subform within you main form. Set the subform property to invisible. Push the button (on click - me.subfrm.visible = true), the subform becomes visible and shows you the rest of the data. It would take about two minutes to do something like that. Is that more like what you had in mind?
 
Yes it is.

However, Here are the particulars:

I have form1 with a button on it. When I press the button I want form2 to pop up. My form2 is a form which is for editing data. Form1 just allows the user to view the data.

In addition, form2 is a form in and of itself, meaning that I also have a menu bar that lists all the forms for editing as a short cut.

 
Ok, that still shouldn't be a problem. Create the subform using an existing form (form2), in form1. Link the two using the appropriate master -child relationship.

If this is something you are unfamiliar with, if you wish to send the forms in question along with a table a couple sample records, I've got some spare time this afternoon and can show you how it's done.

pdldavis@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top