Returning to previous record on Scrolling form

I have a very long form with sometimes hundreds of records.  For each record, 
there is a text box where the user can enter a quantity to be added/deleted 
to the existing quantity.  Once the quantity has been added/deleted, the form 
requeries so that the quantity displayed is now accurate.

Since the form is so long, I want a way for the form to return to the record 
that the user just updated.  In Access 2003, I used this code:

dim rst as recordset
dim IntKeyVal as string
IntKeyVal = idx_IDNumber
Application.Echo False

<<<other VBA code here to add/delete from existing quantity>>>

set rst = me.recordsetclone
rst.findfirst IntKeyVal
me.bookmark = rst.bookmark
Application.Echo True

This worked well in Access 2003, but does not work in Access 2007.  Access 
2007 returns an error that says "Run Time Error '3001' Invalid Argument" and 
when I debug, highlights the rst.findfirst IntKeyVal line.  I should point 
out that the IntKeyVal value is correct (when I hover over the line to see 
the value).

Any help anyone can give would be most appreciated.

Brian

0
Utf
10/19/2007 1:12:00 PM
access.formscoding 7493 articles. 0 followers. Follow

4 Replies
553 Views

Similar Articles

[PageSpeed] 47

"Brian" <Brian@discussions.microsoft.com> wrote in message 
news:76B2FBB0-0D4C-4229-BAA3-F65383DA7667@microsoft.com...
>I have a very long form with sometimes hundreds of records.  For each 
>record,
> there is a text box where the user can enter a quantity to be 
> added/deleted
> to the existing quantity.  Once the quantity has been added/deleted, the 
> form
> requeries so that the quantity displayed is now accurate.
>
> Since the form is so long, I want a way for the form to return to the 
> record
> that the user just updated.  In Access 2003, I used this code:
>
> dim rst as recordset
> dim IntKeyVal as string
> IntKeyVal = idx_IDNumber
> Application.Echo False
>
> <<<other VBA code here to add/delete from existing quantity>>>
>
> set rst = me.recordsetclone
> rst.findfirst IntKeyVal
> me.bookmark = rst.bookmark
> Application.Echo True
>
> This worked well in Access 2003, but does not work in Access 2007.  Access
> 2007 returns an error that says "Run Time Error '3001' Invalid Argument" 
> and
> when I debug, highlights the rst.findfirst IntKeyVal line.  I should point
> out that the IntKeyVal value is correct (when I hover over the line to see
> the value).
>
> Any help anyone can give would be most appreciated.
>
> Brian
>

If you're using DAO, try explicitly typing the rst variable:

dim rst as DAO.recordset


Carl Rapson


0
Carl
10/19/2007 2:17:47 PM
I've tried both:

dim rst as recordset
dim rst as dao.recordset

I use DAO so I tried that first.  When that didn't work., I eliminated the 
DAO and it still didn't work.

The error is the same for both.
ANy other suggestions?

Brian

0
Utf
10/19/2007 2:26:02 PM
> rst.findfirst IntKeyVal
this line is incomplete

   rst.FindFirst CriteriaPhraseAsString

"CriteriaPhrase" is like a SQL Where clause without the Where:
    rst.FindFirst "SomeFieldname = SomeValue"
    rst.FindFirst  "[IDNumber] = '" & IntkeyValue & "'" (if IDNumber is a 
text field)
    rst.FindFirst  "[IDNumber] = " & intKeyValue (if IDNumber is a numeric 
field)

> This worked well in Access 2003,
No, that's not possible. Your code *must* have changed.

HTH,


"Brian" <Brian@discussions.microsoft.com> wrote in message 
news:76B2FBB0-0D4C-4229-BAA3-F65383DA7667@microsoft.com...
>I have a very long form with sometimes hundreds of records.  For each 
>record,
> there is a text box where the user can enter a quantity to be 
> added/deleted
> to the existing quantity.  Once the quantity has been added/deleted, the 
> form
> requeries so that the quantity displayed is now accurate.
>
> Since the form is so long, I want a way for the form to return to the 
> record
> that the user just updated.  In Access 2003, I used this code:
>
> dim rst as recordset
> dim IntKeyVal as string
> IntKeyVal = idx_IDNumber
> Application.Echo False
>
> <<<other VBA code here to add/delete from existing quantity>>>
>
> set rst = me.recordsetclone
> rst.findfirst IntKeyVal
> me.bookmark = rst.bookmark
> Application.Echo True
>
> This worked well in Access 2003, but does not work in Access 2007.  Access
> 2007 returns an error that says "Run Time Error '3001' Invalid Argument" 
> and
> when I debug, highlights the rst.findfirst IntKeyVal line.  I should point
> out that the IntKeyVal value is correct (when I hover over the line to see
> the value).
>
> Any help anyone can give would be most appreciated.
>
> Brian
> 


0
George
10/19/2007 6:37:06 PM
> rst.findfirst IntKeyVal
this line is incomplete

   rst.FindFirst CriteriaPhraseAsString

"CriteriaPhrase" is like a SQL Where clause without the Where:
    rst.FindFirst "SomeFieldname = SomeValue"
    rst.FindFirst  "[IDNumber] = '" & IntkeyValue & "'" (if IDNumber is a
text field)
    rst.FindFirst  "[IDNumber] = " & intKeyValue (if IDNumber is a numeric
field)

> This worked well in Access 2003,
No, that's not possible. Your code *must* have changed.

HTH,


"Brian" <Brian@discussions.microsoft.com> wrote in message
news:76B2FBB0-0D4C-4229-BAA3-F65383DA7667@microsoft.com...
>I have a very long form with sometimes hundreds of records.  For each
>record,
> there is a text box where the user can enter a quantity to be
> added/deleted
> to the existing quantity.  Once the quantity has been added/deleted, the
> form
> requeries so that the quantity displayed is now accurate.
>
> Since the form is so long, I want a way for the form to return to the
> record
> that the user just updated.  In Access 2003, I used this code:
>
> dim rst as recordset
> dim IntKeyVal as string
> IntKeyVal = idx_IDNumber
> Application.Echo False
>
> <<<other VBA code here to add/delete from existing quantity>>>
>
> set rst = me.recordsetclone
> rst.findfirst IntKeyVal
> me.bookmark = rst.bookmark
> Application.Echo True
>
> This worked well in Access 2003, but does not work in Access 2007.  Access
> 2007 returns an error that says "Run Time Error '3001' Invalid Argument"
> and
> when I debug, highlights the rst.findfirst IntKeyVal line.  I should point
> out that the IntKeyVal value is correct (when I hover over the line to see
> the value).
>
> Any help anyone can give would be most appreciated.
>
> Brian
>



0
George
10/19/2007 6:37:55 PM
Reply:

Similar Artilces:

Don't add record
Greetings- This must be easy. I have an input form attached to a file. I have a command button labeled "Cancel" with an "on-click" event "DoCmd.Close" I enter some data, but decide not to add the record. I click the Cancel command button, but the messed up record is inserted into the file. What command or event do I use to close the form without adding a record? Thank-you, Mike On Thu, 20 May 2010 15:34:08 -0400, "Mike from Moriches" <Mike@The-Waterways.org> wrote: >Greetings- > This must be easy. I have an input...

Customer Returns
I'd like to know if there someone has written a RMS report that shows the customer account number, customer's name (last, first), and other customer statistics that INCLUDE pieces purchased and pieces returned. Or, if someone with more knowledge of SQL would care to share their coding expertise to accomplish the same, it would be appreciated. ...

Return-Path: <> from Postmater
Hi, I got Exchange 2003 SP1 on Windows 2003 in Native Mode and when I receive bad mail the response is made from postmaster@mydomain.com but the return-path field is blank. With some anti-spam filter this Email is Junk. Return-Path: <> Anybody know how to specifeid a return-path to the NDR mail? _____________ Thank you Sebastien On Fri, 4 Nov 2005 12:48:04 -0800, "Sebas" <Sebas@discussions.microsoft.com> wrote: >Hi, > >I got Exchange 2003 SP1 on Windows 2003 in Native Mode and when I receive >bad mail the response is made from postmaster@mydomain.c...

Site for SOP Returns
Is it possible to have a different default Site ID for Returns than Standard Orders? Yes. You must make sure to change the site when performing a Return Transaction. -- Richard L. Whaley Author / Consultant / MVP 2006-2008 Documentation for Software Users Get our Free Tips and Tricks Newsletter and check out our books at http://www.AccoladePublications.com "Everton Raymond" wrote: > Is it possible to have a different default Site ID for Returns than Standard > Orders? Sorry, I did not see the word "default" in your post until after I r...

Timer form event
I would like to trigger this event once a day at the same time. Any suggestions. Thanks, Stanley ...

how to change the default form of a folder
can anyone please tell me how to change the default form of a folder to use a non-standard custom form. i have tried the syeps on the site. the link is a s follows: http://support.microsoft.com/default.aspx?scid=kb;en-us;292782 but the problem is that there is no way i can create an intermediate form. i have tried it. i am using outlook 2003. ...

Query regarding A,B,C char. width values returned in 16-bit and 32-bit OS
I am trying to retrieve individual character widths of a string (from a TrueType font) and I tried using GetCharWidth (which weirdly works for TrueType fonts too tho' MSDN says otherwise) and/or GetCharABCWidths to retrieve the A,B and C spacings. Please note that I have selected the TrueType font (hFont) into the Device Context (hDC). I used GetCharABCWidths. Problem is this: GetCharABCWidths returns correct A,B and C widths in Win 98 and incorrect (much lesser A,B and C widths such that the characters OVERLAP) in other 32-bit OS (NT, XP). The effect is seen across all TrueType fonts, th...

Scroll Bar in Subform
How do I remove the scroll bar from a subform on a purchase order form? At the bottom of the subform it shows the number of records. I want to remove that info from site. The form I receated is a Purchase Order form very similar to the Inventory Management Database Template. I just changed it a litte to meet our needs. I enter the info into the form and then the items I am purchasing into the subform. I save the record and the info is saved to the table where it is suppose to be. When I open the form up to a new purchase order, the subform from the previouse order is displayed....

Report for Returns
Anyone know a why to report on frequency of customer returns -- so we can see if any customers are making habit of this? Thanks and regards, Rich hitman, Try running a detailed sales report filtered to only negative sales displayed. Good luck, Matt "hitman" <hitman@discussions.microsoft.com> wrote in message news:0B3EE780-2655-45B4-B3C6-1F5D35FFA2A7@microsoft.com... > Anyone know a why to report on frequency of customer returns -- so we can > see > if any customers are making habit of this? > > Thanks and regards, > > Rich ...

Export Table Records to txt file
Hi all, I have Table "T_Data" in my database. In "T_Data" I have 220000 records. I need to export them into txt files. I need some kind of macro which should export chunk of 60000 records into one txt file and save that file in folder called "Data" on "C:\" drive. Macro should also put numbers at the end of each txt file name. Like (See below) Data 1.txt Data 2.txt Data 3.txt etc=85.. I'll be very greatful if any friend can help me on this as I am struggling on this. ...

Returning the Beginning of the week
Returning the beginning of the week. e.g. if the date == 02/03/04 (Friday 2nd March 2004) the beginning week for that date == 01/03/04 (Thursday 1st March 2004) Hows does one go about achieving this? Regards -- Rizitsu ------------------------------------------------------------------------ Rizitsu's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=15840 View this thread: http://www.excelforum.com/showthread.php?threadid=314968 This formula will take a date in cell A1 and give the start of the wee in B1 * assumes that monday is the start of the week, so i...

return
Capability of the system to automatically change the status of the PO to change order, and add line items that have been returned. ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader and then click "I Agree" in the message pane. http://www.microsoft.com/Businesssolutions/Community/NewsGroups/dgbrowser/en-us/default.ms...

form creating new row in table1, looking for field value in table
Please can someone help as I have been battling all week with this problem, and haven't had a response. I have a form which uses some data from table1 to create an entry in table2 (i know duplication is bad, but as this is a live database, and i am working on a new section, this makes this complicated task easier), which works fine. however, i have a third table that has the unique ID from table1 and table2 in order to show when a table1 row of data is needed in table2 via a checkbox. This third table3 is created when elsewhere. The problem lies with bringing in the unique ID value...

Return
When returning an item, can you return the item by selecting the matrix rather than the individual item and changing the quantity to -1? Hi KIm, Normally this won't work as it works in sale where for each matrix type you can put the qunatites. HOWEVER when you select the matrix item it bring the matrix window but allow only one item at a time to be returned and make the -1 qty automatically in return document type. It work but one by one. Regards Akber "Kim" wrote: > When returning an item, can you return the item by selecting the matrix > rather than the individua...

creating a fillable area in a fillable forms...
I have creted a fillable form with drop downs and fields, but I have a couple of areas where I am trying to create defined areas where the person can enter a short paragraph of text. I guess I'm looking for a field which is defined and the text wraps automatically to the next line(without altering the rest of the document). So far I have tried a simple text field with unlimited characters but the text does not wrap inside the box. Any thoughts? You can place the text form field inside a (border-less) table cell whose width is fixed. -- Stefan Blom Microsoft Word MVP ...

Report combiones all records
Access 2007 on WinXP Report creted based on query: SELECT tblParticipantTrx.EmpID, tblSessions.StrtDate, tblSessions.StartTime, tblClasses.ClassName, tblParticipants.EmpFname, tblParticipants.EmpLname, tblSessions.MaxParticipants FROM (tblClasses INNER JOIN tblSessions ON tblClasses.ClassID = tblSessions.ClassID) INNER JOIN (tblParticipants INNER JOIN tblParticipantTrx ON tblParticipants.EmpID = tblParticipantTrx.EmpID) ON tblSessions.SessionID = tblParticipantTrx.SessionID WHERE (((tblSessions.StrtDate) Between [Begin] And [end])) ORDER BY tblSessions.StrtDate, tblSessions.St...

Autocomplete email domain from previous record
Hi All, I have a form with an email address field in which the domain is often the same for each new record. For example, test@domain.com... the "@domain.com" portion is often the same. What I would like to do is somehow have some code that autocompletes just the domain portion from the previous record when the user types the "@" symbol. So, they can then type in "test2" and as soon as they hit the @ symbol it would complete the field with the domain portion from the previous record. Does anyone have a genius way to do this? :-) Thank you for your help!...

Out of nowhere, my forms all open as Maximized
Good Day, This wasn't happening before. All my forms have the default veiw set to single form and the Min/Max Buttons are both Enabled. When I veiw the forms in the Design Veiw, they show in a small area of the window, but when I go into the Form View, it takes up the entire area and the Min/Max Buttons are not available. Thank you very much! -debi- Hi Debi, If you didn't mess with the controls, you might have "Maximize" some in your code. "-debi-" wrote: > Good Day, > > This wasn't happening before. All my forms have the default veiw set...

Returning Multiple Values in a Single Cell
Hello, I posted this same question a couple of weeks ago but forgot to mention a key point. My question was as follows: I have read a few posts regarding this subject but am still somewhat lost. I have a two sheet workbook (Excel 2000). On the first sheet is a list of projects that my department will complete during the year. A description of each project is given, a start date, an end date, as well as which crew will be completing the work (Crew 1 or Crew 2). What I am trying to do on the second sheet is to be able to type in any date, and have the description of the project on that da...

Returns immediate function
Hi all, I know that the function CeRapiInitEx returns immediately. No wait for processing. I want to implement such a function. Returns immediate. no wait. How do I implement such a function? Thanks Ko You might create a UI thread that do the work, launch it in the "non-wait" function and return immediatly to the caller. When the thread done it's works, you can post an application message to return the results.... Greetings, Gaetano Sferra "PPC DEV" <ppc_dev@yahoo.com> ha scritto nel messaggio news:033101c3b388$a7098910$a301280a@phx.gbl... > Hi all...

way to open a form in mutliple instances?
Is there a way to open up a form in more than one instance. i.e. the same form but different data? If so, what is the methos? Thanks for any help. Yes, there is. See the sample code at http://www.daiglenet.com/msaccess.htm The Multi_Instance Forms download is the last one on this page. HTH, Rob "ThorBo" <ThorBo@discussions.microsoft.com> wrote in message news:0296148F-5664-4584-90D6-CDE1BCCC3DED@microsoft.com... > Is there a way to open up a form in more than one instance. i.e. the same > form but different data? If so, what is the methos? > > Thanks for ...

Move to Previous Location
Hi, Curser was in page1 of a document. I scrolled to page 5 and selected an item in page 5. Now I want to go to previous location. Is there a shortcut for doing this? Thanks! GoBack (Shift+F5). GoBack will skip back to the previous 5 edit points. -- Terry Farrell - MSWord MVP "Maanu" <Maanu@discussions.microsoft.com> wrote in message news:4B07034B-78EC-4B09-B015-6B7DFCF625E9@microsoft.com... > Hi, > > Curser was in page1 of a document. I scrolled to page 5 and selected an > item > in page 5. Now I want to go to previous location. >...

Import Outlook Custom Form Data From Another Inbox
I have a vba process that cycles thru my Inbox and imports data from a number of custom forms. This data is then updated within my access database, and reports are created. I tried using the same vba code to cycle thru another mailbox (which i have admin rights to), but am receiving a "type mismatch" error on line# 3 below. Dim fld As Outlook.MAPIFolder Dim itm as Object 'Assuming fld is populated in prior steps using the PickFolder command 1) For Each itm In fld.Items 2) If itm.Class = olMail Then 3) Set msg = itm .... .... 5) Next itm Any ideas why this code works fin...

Invoice Form Question
I've created an Invoice form which seems to work pretty well for creating invoices, but now the Office folks would like to add some functionality. Right now, we track our orders by Order Number. The Order Entry table includes information that is unique to the order as a whole. There is also an associated Order Details table which includes information specific the line item for a specific order. The Part Numbers table includes information that is standard to the Part Number. Right now the Invoice information is included on the Order Entry table. My thinking was that the relatio...

Lookup Values, return multiple.
I need help please. The formula I require has to in Worksheet A :- [B1] lookup DATA in Worksheet A [A1] SP001 in worksheet B [A] [B] [C] SP001 PL001 16 SP001 PL002 5 SP001 DR001 10 CR001 PL001 2 Search for all Text String starting with "PL" in Worksheet B [B] only for SP001 in [A] and return with values from Worksheet B [C] 16 and 5 I need the values to be seperated and not summed. Tx. Appreciate assistance. Try this... In the formulas: Rng1 refers to worksheet B $A$2:$A$5 Rng2 refers ...