473,473 Members | 1,813 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to use bookmark property with recordset based on query?

tuxalot
200 New Member
I am trying to move to the first record in a form where a value is false. The underlying form uses a query as it's record source. I am getting an "invalid argument" error where indicated below in code:
Expand|Select|Wrap|Line Numbers
  1.     Dim intCountMissing As Integer
  2.     Dim strCriteria As String
  3.     'check for incomplete (not finalized) surveys on startup
  4.     intCountMissing = Nz(DLookup("[RspnsID]", "tblSrvRspns", "[SurveyComplete] = " & False))
  5.     If intCountMissing > 0 Then
  6.         Select Case MsgBox("You have surveys that are not yet finalized." _
  7.                            & vbCrLf & "" _
  8.                            & vbCrLf & "Ok to open the first unfinished survey" _
  9.                            & vbCrLf & "Cancel to disregard" _
  10.                            , vbOKCancel Or vbQuestion Or vbDefaultButton1, "Survey Check")
  11.             Case vbOK
  12.                 strCriteria = intCountMissing
  13.                 MsgBox strCriteria
  14.                 With Me.RecordsetClone
  15.                     .FindFirst strCriteria   <<<   INVALID ARGUMENT
  16.                     If Not .NoMatch Then
  17.                         Me.Bookmark = .Bookmark
  18.                     End If
  19.                 End With
  20.             Case vbCancel
  21.         End Select
  22.     End If
  23.  
Not much hair left, been at this for hours and have been through many threads but can't for the life of me figure this out. I ultimately would like this to run when the form opens but for testing I have it on a button.

Thanks for your help!
Dec 7 '10 #1
3 2759
ADezii
8,834 Recognized Expert Expert
Try:
Expand|Select|Wrap|Line Numbers
  1. Dim strCriteria As String
  2. Dim intCountMissing As Integer
  3. Dim rst As DAO.Recordset
  4.  
  5. Set rst = Me.RecordsetClone
  6.  
  7. 'check for incomplete (not finalized) surveys on startup
  8. intCountMissing = DLookup("[RspnsID]", "tblSrvRspns", "[SurveyComplete] = False")
  9.  
  10. If intCountMissing > 0 Then
  11.   Select Case MsgBox("You have surveys that are not yet finalized." _
  12.                       & vbCrLf & "" _
  13.                       & vbCrLf & "Ok to open the first unfinished survey" _
  14.                       & vbCrLf & "Cancel to disregard" _
  15.                       , vbOKCancel + vbQuestion + vbDefaultButton1, "Survey Check")
  16.     Case vbOK
  17.       strCriteria = "[RspnsID] = " & intCountMissing
  18.  
  19.         With rst
  20.           .FindFirst strCriteria
  21.             If Not .NoMatch Then
  22.               Me.Bookmark = .Bookmark
  23.             End If
  24.         End With
  25.     Case vbCancel
  26.   End Select
  27. End If
Dec 7 '10 #2
tuxalot
200 New Member
Man, thanks for coming to my rescue again ADezii.

Cheers!
Dec 7 '10 #3
ADezii
8,834 Recognized Expert Expert
That's what we are all here for (LOL).
Dec 7 '10 #4

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

Similar topics

2
by: Alex | last post by:
Subject: Looking for an XML (database-based) Query Reporting Tool/advice First off, let me apologize if this thread is somewhat off topic... PLEASE REPLY TO: xml@solex-bi.com I am looking...
0
by: David Holmes | last post by:
Hi All Plasee could someone explain how the bookmark property works, is it assoiated with the table our the form.. I have asubform displaying in contiuous view and and sometimes I would like...
1
by: VivN | last post by:
I am using the following code to open a recordset returned by a SQL server stored procedure: sConn = "Provider='SQLOLEDB';Data Source='Aph-Ework-Dev';" & _ "Initial...
2
by: info | last post by:
I can successfully open a recordset based upon an Excel sheet in Access, but I can't work out how to copy all the records to an Access table. Any pointers?
2
by: ajspacemanspiff | last post by:
I currently have a solution that requires 2 sub queries, where each of them is convereted into a crosstab query and then I join the crosstab queries to a result. I would like to make this more...
2
by: cwhite | last post by:
I'm having problems with a form based query The user makes a selection from a drop box, there are only two choices: Current Former the user makes a choice and clicks the preview report...
0
by: CanFlightSim | last post by:
I use combo boxes and a great little piece of code to fill a form with a record set. For example I want to search by Lastname and fill the form or by company and fill the form, I will start typing...
5
by: SeanCly10 | last post by:
Hi all. I don't want to sound like a complete idiot here, but I'm somewhat limited in my coding knowledge, and I need some advice and help. I'm working on a database that will eventually be used...
1
by: MikeMikerson | last post by:
Hello, I am need to create a subform (no problem) of a form based query (a problem). I need a form that will prompt the user to enter in a name, and the form will then display a query of the...
10
by: bullfrog83 | last post by:
I am trying to requery a recordset so that a form changes record based on a combobox. In the form's Open event I'm using this code: Dim cn As New ADODB.Connection Dim rs As...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...
1
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
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.