By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,089 Members | 2,283 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,089 IT Pros & Developers. It's quick & easy.

Passing bookmarks between modules...

patjones
Expert 100+
P: 931
Hi:

I have a form in my Access project called "frmWC", and a form called "frmModifyClaim". In frmWC, I set a bookmark like so:

Set rst = Me.RecordsetClone

rst.FindFirst "[tblWC].[fldClaimNum] = '" & Me![cmbSelectClaimNum] & "'"

Me.Bookmark = rst.Bookmark

What I want to be able to do is open frmModifyClaim, and have it go to the same record that is showing on frmWC...in other words pass this bookmark on to frmModifyClaim.

How can this be accomplished?

Thank you!

Pat
Jul 16 '07 #1
Share this Question
Share on Google+
5 Replies


ADezii
Expert 5K+
P: 8,638
Hi:

I have a form in my Access project called "frmWC", and a form called "frmModifyClaim". In frmWC, I set a bookmark like so:

Set rst = Me.RecordsetClone

rst.FindFirst "[tblWC].[fldClaimNum] = '" & Me![cmbSelectClaimNum] & "'"

Me.Bookmark = rst.Bookmark

What I want to be able to do is open frmModifyClaim, and have it go to the same record that is showing on frmWC...in other words pass this bookmark on to frmModifyClaim.

How can this be accomplished?

Thank you!

Pat
  1. Declare a Public Variable in a Standard Code Module as follows:
    Expand|Select|Wrap|Line Numbers
    1. Public strClaimNum As String
  2. Add this additional line of code:
    Expand|Select|Wrap|Line Numbers
    1. Set rst = Me.RecordsetClone
    2. rst.FindFirst "[tblWC].[fldClaimNum] = '" & Me![cmbSelectClaimNum] & "'" 
    3. Me.Bookmark = rst.Bookmark
    4.  
    5. '>>>>>>>>>>>>> additional line of code here >>>>>>>>>>>>>
    6. strClaimNum = Me![cmbSelectClaimNum]
  3. In the Open() Event of frmModifyClaim, enter the following code lines:
    Expand|Select|Wrap|Line Numbers
    1. 'Substitute the appropriate Field name for Claim Number
    2. Me![txtClaimNumber].SetFocus
    3. DoCmd.FindRecord strClaimNum
  4. You will advance directly to the same Claim Number in frmModifyClaim.
  5. Good Luck!
Jul 16 '07 #2

Expert 100+
P: 634
Hi

stDocName = "frmModifyClaim"
stLinkCriteria="fldClaimNum = '" & cmbSelectClaimNum & "'"

DoCmd.OpenForm stDocName, , , stLinkCriteria

???


MTB
Jul 17 '07 #3

ADezii
Expert 5K+
P: 8,638
Hi

stDocName = "frmModifyClaim"
stLinkCriteria="fldClaimNum = '" & cmbSelectClaimNum & "'"

DoCmd.OpenForm stDocName, , , stLinkCriteria

???


MTB
MTB, the only problem with this approach is that the Form will be Filtered for the specific stLinkCriteria and will only display a single Record. In the other approach, all Records for the underlying Record Source of the Form are displayed, but the Record for the specified Claim Number will now be the Current Record. This will basically mimic the Bookmark functionality.
Jul 17 '07 #4

patjones
Expert 100+
P: 931
Hi:

Thanks for your responses! I'm going to try both approaches. At first glance, I don't have a problem with MTB's method, because in frmModifyClaim I want to work with one record only...i.e. the claim that the end user wants to modify. Unless you were referring to something else?

In other words, in frmWC, a particular person can have more than one claim, and chooses which one to view by picking one from a combo box. After making the selection and populating the form with that claim's data, the user can click on a hyperlink "Modify this claim" to pop up frmModifyClaim and change the information for that claim.

Again, I will try both approaches. I was upgraded to Office 2007 today, so there are a few other more pressing issues to deal with right now :-)

Thanks!

Pat
Jul 18 '07 #5

Expert 100+
P: 634
Hi
Hi:

Thanks for your responses! I'm going to try both approaches. At first glance, I don't have a problem with MTB's method, because in frmModifyClaim I want to work with one record only...i.e. the claim that the end user wants to modify. Unless you were referring to something else?

In other words, in frmWC, a particular person can have more than one claim, and chooses which one to view by picking one from a combo box. After making the selection and populating the form with that claim's data, the user can click on a hyperlink "Modify this claim" to pop up frmModifyClaim and change the information for that claim.

Again, I will try both approaches. I was upgraded to Office 2007 today, so there are a few other more pressing issues to deal with right now :-)

Thanks!

Pat
Yes from your origianal post I thought that was the case.

If you do not want to filter the form opened, but jut got to the specific record as ADezil was proposing then I now use this technique

DoCmd.OpenForm "frmEmployeeDetails"

Form_frmEmployeeDetails.Recordset.FindFirst "ID = " & [ID]

BTW, to answer your initial question, a bookmark is only valid for the specific recordset/form, if you requery or reopen a recorset/form the bookmarks all change because they are generated at that time. Therefore you cannot pass bookmarks between modules/forms or anything else.


MTB
Jul 18 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.