473,395 Members | 2,467 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Invalid bookmark error

4
I have a main Form with two subforms and these two subforms are setup in a master/detail scenario. First subform (lets call this SubFormA) contain Order records and the second subform (SubFormB) contain the Order Detail records. If I click on a Order record in SubFormA, then the Order Detail records will be shown in SubFormB. I am using the Order/Detail paradigm for simplicity sake.

The problem I have been tearing my hair off, is that I want SubFormA to be requeried (not refreshed, due some calculated fields in the form datasource) , if I update a record in SubFormB. The requery part works flawless, but I want to reselect the Order record the user had selected, because a requery will jump to 1st record by default.

I am trying to achieve this with Bookmarks and I am receiving "Not a valid bookmark" error. I am using the "After Update" event in SubFormB to call the procedure RefreshVenueEstimate (see code) to refresh SubFormA.

Expand|Select|Wrap|Line Numbers
  1. Sub RefreshVenueEstimate()
  2.  
  3.     Dim rst As DAO.Recordset
  4.     Dim VenueMaterialEstimateID As Long
  5.  
  6.     VenueMaterialEstimateID = Me.Parent.Child_Venue_Material_Estimates!id
  7.  
  8.     Me.Parent.Child_Venue_Material_Estimates.Form.Requery
  9.  
  10.     Set rst = Me.Parent.Child_Venue_Material_Estimates.Form.RecordsetClone
  11.     rst.FindFirst "id = " & VenueMaterialEstimateID
  12.     If Not rst.NoMatch Then
  13.         Me.Parent.Child_Venue_Material_Estimates.Form.Bookmark = rst.Bookmark
  14.     End If
  15.     rst.Close
  16.     Set rst = Nothing
  17.  
  18. End Sub
  19.  
Any help is very much appreciated.
Mar 22 '12 #1
6 4119
NeoPa
32,556 Expert Mod 16PB
Nowhere in your code does it save the .Bookmark of the record you wish to return to. A Bookmark is a string value (containing binary data) that identifies a record uniquely. Setting rst.Bookmark to the saved value returns the current record pointer to the record it was at when it was saved.

For more see Context-Sensitive Help using Bookmark.
Mar 24 '12 #2
Lorref
4
Thanks, but I am not following your response. I have scoured the web for this common problem and it seems to me that recordset cloning is the best way to solve this. Just some references that I read:
http://msdn.microsoft.com/en-us/libr...ffice.11).aspx
http://www.everythingaccess.com/tuto...form-is-opened

Am I misinterpreting these samples? Any input is very welcome!
Mar 26 '12 #3
Lorref
4
NeoPa, I worked out your suggestion, using the following code in my form.

Expand|Select|Wrap|Line Numbers
  1.  
  2.     Dim varBookmark As Variant
  3.  
  4.     If Me.Recordset.Bookmarkable Then
  5.         varBookmark = Me.Bookmark
  6.         Me.Bookmark = varBookmark
  7.     End If
  8.  
I don't do a record delete, or change the primary key value, just update a record. But when this codes executes (After Update event) it still is throwing the invalid bookmark error, when I set the bookmark! WTF? I am saving the bookmark, do nothing, set the bookmark and to get an error. I am lost!
Mar 26 '12 #4
NeoPa
32,556 Expert Mod 16PB
You don't say whether the current record actually has a value at the point the code is run. Is the event you are using control-level or form-level? What happens if you try this same code on an existing record?
Mar 26 '12 #5
Lorref
4
There are existing records that I read from a table, so yes, I am changing existing records. And I run this at the "After Update" event on the Form level.

Some update on this. The form Record Source has a query with a sort clause in the query. I removed the sort clause from the query and my Bookmark error doesn't show any more. However, setting the bookmark does nothing, after requery it still stays at the first record.

NeoPa, do you know an alternative to this weird problem
Mar 26 '12 #6
NeoPa
32,556 Expert Mod 16PB
I've seen nothing that indicates to me that the problem is weird. I've seen nothing from you yet that I would expect to work.

The bookmark should be saved before you leave the record (so probably not in the form's AfterUpdate event procedure), and then set back when you want it. So far, when you're doing things the right way, I've seen nothing go wrong. The only problem I'm aware of seems to be in your understanding of the issues. That's not a problem in itself, but it doesn't help to interpret that as an Access problem ;-)
Mar 26 '12 #7

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

Similar topics

4
by: Bradley Kite | last post by:
Hi all. I'm trying to diagnose/solve a problem with internet explorer, whereby sometimes the form submits, and other times IE produces an 'invalid syntax' error. First, I have a form, and...
8
by: Owen Jenkins | last post by:
Hello. For years I've been using the DBEngine.CompactDatabase code to make backups of backend databases. But now I've struck a baffling problem where I get an Invalid Argument error. This...
2
by: Thelma Lubkin | last post by:
With Me!PERSONSLIST.Form.RecordsetClone .FindFirst strID If .NoMatch Then Debug.Print "key " & Key & " nomatch" Exit Sub Else If Me.Dirty Then Me.Dirty = False Debug.Print "A_LOAD bookmark = "...
5
by: Owen Jenkins | last post by:
I have a database running in Access (FE in 2000-2002 on local drive, BE in 2000 on network server). It has a main form with several subforms and several user-operated filtering options....
0
by: Mark Phanides | last post by:
My ASP.NET application intermittantly (but always at same point) redirects to the 'Invalid Syntax Error' web page for some unknown reason. I've created a ASP.NET application written in VB.NET with...
9
by: Jamie | last post by:
I am receiving an Invalid ViewState error after posting back to the same page twice. Consistently the error occurs after the second postback and not after the first. I have looked into creating...
2
by: Schorschi | last post by:
Can't seemd to get ReadFile API to work! Returns invalid handle error? =========================================================================== Ok, the visual basic gurus, help! The...
2
by: py | last post by:
Hi, I am running python 2.4.2 on win xp pro. I have the WMI module from Tim Golden (http://tgolden.sc.sabren.com/python/wmi.html). I have some code which does this... MyScript.py...
5
by: Grant Edwards | last post by:
I'm trying to use the py-gnuplot module on windows, and have been unable to get it to work reliably under Win2K and WinXP. By default, it uses popen(gnuplotcmd,'w'), but in some situations that...
3
by: kakarot vegeta | last post by:
There 's an invalid syntax error but i don't know what's wrong with it. the error says Invalid syntax: print variation_string import itertools variations = itertools.product('ab',...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.