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!

Problems with bookmarks

Status
Not open for further replies.

Bresart

Programmer
Feb 14, 2007
314
ES
Hi, i have a DB with two smilar forms, one is editable and the other isn't. The forms have a secondary form, Secundario70, with photographs. What i want is when changing between forms through a button in each o them, both main and secondary forms show the record that showed the original form. For example, if i am viewing in editable form the main record 34 of 486, and in its secondary form the record 3 of 11, when i press the button for changing to the non editable form, once this non editable form is opened the form goes to the record 34 of 486 and the secondary one shows the 3 of 11. It is achieved without problem.

But each form has a combo for making searchings filtering the records consequently, and a button for removing that filter. The filter is kept between the two forms (editable and non editable).

When a search is done, if the current record is between the new filtered records this record is made also the current one and also the record that was being shown in the secondary form. And when the filter is removed, the same occurs.

THE PROBLEM:

If i am in the editable form and i am seeing the record 34 of 486 and in the subform the record 3 of 11, if i make a searching where this record remains it occurs like said, and so also if i change to the non editable form, and so also if i come to the editable one, but now if i remove the filter from the button for that purpose the form shows the record 34 of 486, but the subform shows the record 1 of 11, not the 3.




The code i am using is:



If IsNull(Me.Id) = False Then
idEspGral = Me.Id
idEspFixed = True
End If
If IsNull(Me.Secundario70.Form.[IdFoto]) = False Then
idFotoCurrReg = Me.Secundario70.Form.[IdFoto]
idFotFixed = True
End If

If idEspFixed = True Then
idEspFixed = False
Set rs = Me.Recordset.Clone
rs.findfirst "[Id] = " & idEspGral & ""
If rs.nomatch = False Then
Me.Bookmark = rs.Bookmark
If idFotFixed = True Then
idFotFixed = False

Set rs = Me.Secundario70.Form.Recordset.Clone
rs.findfirst "[IdFoto] = " & idFotoCurrReg & ""
If rs.nomatch = False Then
Me.Secundario70.Form.Bookmark = rs.Bookmark
End If
End If
End If
End If




That is, first the matching in the main form is checked, if it matches then the code checks the matching in the secondary form.

The line that is not working is

Set rs = Me.Secundario70.Form.Recordset.Clone

I have tried also

Set rs = Me.Secundario70.Form.Recordset
Set rs = Me.Secundario70.Form.RecordsetClone

with no result.










I have tried also the code:





If IsNull(Me.Id) = False Then
idEspGral = Me.Id
idEspFixed = True
End If
If IsNull(Me.Secundario70.Form.[IdFoto]) = False Then
idFotoCurrReg = Me.Secundario70.Form.[IdFoto]
idFotFixed = True
End If

If idEspFixed = True Then
idEspFixed = False
Set rs = Me.Recordset.Clone
rs.findfirst "[Id] = " & idEspGral & ""
If rs.nomatch = False Then
Me.Bookmark = rs.Bookmark
If idFotFixed = True Then
idFotFixed = False
strQuery = "SELECT tblFotos.IdFoto FROM tblFotos WHERE tblFotos.Id = " & Me.Id & " ORDER BY tblFotos.orden;"

Set rrdset = New ADODB.Recordset
rrdset.Open strQuery, CurrentProject.Connection, _
adOpenStatic, , adCmdUnknown
If rrdset.EOF <> True Then
rrdset.MoveFirst
End If
Dim matching As Boolean
Do While rrdset.EOF <> True
If rrdset!IdFoto = idFotoCurrReg Then
matching = True
Exit Do
Else
rrdset.MoveNext
End If
Loop
If matching = True Then
Me.Secundario70.Form.Bookmark = rrdset.Bookmark
End If
rrdset.Close
End If
End If
End If







And i have tried with
Me.Secundario70.SetFocus
DoCmd.GoToRecord , , acGoTo, CurrentRecord

But here the problem is that the Current event of the subform is not enetered (it must be entered for showing in a second subform the corresponding photograph).







I don't know if the bookmarks can be implemented in other ways; in that case i would check all the possibilities.

Thanks for any help given.
 
Why do you have 2 different versions of the same forms ?
Why not simply change the AllowEdits, AllowAdditions, ... properties in the Click event of your button ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Because they have much more different functions.ç

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top