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

Go to a duplicate record on another form - but not filtering it!

Status
Not open for further replies.

kb178

IS-IT--Management
Aug 16, 2001
83
US
I've been looking for a few hours for this and can't seem to find what I'm looking for. All I want to do is open a form based on another form - however I don't want to have the form that is opened filtered.
So, right now I have
stLinkCriteria = "[ID]=" & Me![ID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
But I don't want the new form to only contain that id - I just want it to go to that id. Any ideas?
Thanks!
 
Something like this should be close

dim rst as recordset
stLinkCriteria = "[ID]=" & Me![ID]
DoCmd.OpenForm formname
set rst = forms!formname.recordsetclone
rst.findfirst stLinkCriteria
set forms!formname.bookmark = rst.bookmark
set rst = nothing
 
Thanks for the help - but I'm getting a type mismatch error. I don't know why though - shouldn't my id field be an integer?
This is the code I have that's giving the error:

Dim stDocName As String
Dim stLinkCriteria As Integer
Dim rst As Recordset

stDocName = "Add_Name"
stLinkCriteria = "[ID] = " & Me![ID]

DoCmd.OpenForm stDocName
Set rst = Forms!Add_Name.RecordsetClone
rst.Find stLinkCriteria
Set Forms!Add_Name.Bookmark = rst.Bookmark
Set rst = Nothing
DoCmd.Close acForm, "Dup_Check"
 
Hi,

I have exactly the same situation as yourself - I was wondering whether you managed to debug your type mismatch error?
 
Hi

Have a look at the FAQ for this section, I notice theres a method there

Rob
 
I don't know what to tell you
I do this often in Access 97

ensure you are building the criteria propery based on the field type
One other thought is if using Access 2000 perhaps you need to say

dim rst as dao.recordset but
I don't think so and I don't have 2000 here to test on

here is copy of working code
note due code is a number field

Dim rst As Recordset
Dim stLinkCriteria As String
stLinkCriteria = "duecode = " & Me!Text81
DoCmd.OpenForm "ctdlog"
Set rst = Forms!ctdlog.RecordsetClone
rst.FindFirst stLinkCriteria
Forms!ctdlog.Bookmark = rst.Bookmark
Set rst = Nothing
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top