Find First

I am having trouble making this work.  I am trying to do a find in a subform.

    Dim rs As DAO.Recordset

    If Not IsNull(Me.Command33) Then
        Set rs = Forms![fAddGroupCat]![fAddGroupCatSub2].[Form].RecordsetClone
        rs.FindFirst "[Descr2] = """ & Me.Command33 & """"
        If rs.NoMatch Then
            MsgBox "Not found"
        Else
            Me.Bookmark = rs.Bookmark
        End If
        Set rs = Nothing
    End If


Thank you,

Steven

Also:  How can you tell it to start at the last record and find looking back 
up?


Thank you,

Steven


0
Utf
5/6/2010 9:12:04 PM
access.modulesdaovba 1670 articles. 0 followers. Follow

3 Replies
654 Views

Similar Articles

[PageSpeed] 55

The first question that has to be asked is what kind of control is Command33?


A control name starting with Command is normally a Command Button. Command
Buttons do not have a value and thus cannot be Null or not Null, and cannot
be  used in something like

 "[Descr2] = """ & Me.Command33 & """"

-- 
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted via http://www.accessmonster.com

0
Linq
5/6/2010 9:27:32 PM
Steven wrote:

>I am having trouble making this work.  I am trying to do a find in a subform.
>
>    Dim rs As DAO.Recordset
>
>    If Not IsNull(Me.Command33) Then
>        Set rs = Forms![fAddGroupCat]![fAddGroupCatSub2].[Form].RecordsetClone
>        rs.FindFirst "[Descr2] = """ & Me.Command33 & """"
>        If rs.NoMatch Then
>            MsgBox "Not found"
>        Else
>            Me.Bookmark = rs.Bookmark
>        End If
>        Set rs = Nothing
>    End If
>
>Also:  How can you tell it to start at the last record and find looking back 
>up?


If Command33 is a text box, then it should work.

If you want to start at the end of the recordset, use
FindLast instead of FindFirst

-- 
Marsh
MVP [MS Access]
0
Marshall
5/6/2010 10:25:01 PM
Where are you running this code?
This line
    Set rs = Forms![fAddGroupCat]![fAddGroupCatSub2].[Form].RecordsetClone
makes me think that you are executing the code in the main form instead of in 
the subform.

If that is true then this line
    Me.Bookmark = rs.Bookmark
is probably wrong.  Since it would be setting the main form's bookmark equal 
to the subform's bookmark.

So perhaps you want
   Forms![fAddGroupCat]![fAddGroupCatSub2].[Form].Bookmark = rs.Bookmark

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County

Marshall Barton wrote:
> Steven wrote:
> 
>> I am having trouble making this work.  I am trying to do a find in a subform.
>>
>>    Dim rs As DAO.Recordset
>>
>>    If Not IsNull(Me.Command33) Then
>>        Set rs = Forms![fAddGroupCat]![fAddGroupCatSub2].[Form].RecordsetClone
>>        rs.FindFirst "[Descr2] = """ & Me.Command33 & """"
>>        If rs.NoMatch Then
>>            MsgBox "Not found"
>>        Else
>>            Me.Bookmark = rs.Bookmark
>>        End If
>>        Set rs = Nothing
>>    End If
>>
>> Also:  How can you tell it to start at the last record and find looking back 
>> up?
> 
> 
> If Command33 is a text box, then it should work.
> 
> If you want to start at the end of the recordset, use
> FindLast instead of FindFirst
> 
0
John
5/7/2010 12:33:54 PM
Reply:

Similar Artilces:

"last line of receipt printing on first line of next receipt"
I have adjusted the .xml file for the receipt countless times and have downloaded .xml templates from the Customer Source. Every time I print a receipt the last line is cut off and inserted as the first line on the next receipt. Any ideas for fixing this? Thanks! What Printer/Driver combination are you using? I would guess that you're using some variety of Windows Driver, and that the problem has to do with the page size defined there rather than with the Receipt Template... -- -- Glenn Adams Tiber Creek Consulting http://www.tibercreek.com glenn@tibercreek.com ------------------...

First Headline after Continuous Section Breaks
Version: 2008 Operating System: Mac OS X 10.5 (Leopard) Processor: Intel I have a document with 350 Pages, with about 30 continuous section breaks, because I need different text (column titles) for the headlines in each section. But two of the thirty headlines I cannot format as &quot;First Headlines&quot; with the option &quot;First page different&quot;. If I erase the text in that headline, the text in the other headlines in that section is also erased. I tried to erase and to reformat, but with these two it does not work. The other 28 work well. <br><br>I ho...

Error 2465; Can't Find Field
The section of code below is causing me problems. Private Sub AddBadParts() Dim dbs As DAO.Database Dim strSQL As String Dim MyDate Dim MyTime Set dbs = CurrentDb 'strSQL = "INSERT INTO tblTally ([CatalogNumber]) VALUES (" & Me.[txtCatNum] & ");" strSQL = "INSERT INTO tblTally ([CatalogNumber]) VALUES (""Hello 101st Try"");" dbs.Execute strSQL End Sub ID - is the first field in the table (auto number) CatalogNumber - is the second field in th...

how to remove the first exchange 2003 server
Can anyone please send me information on how to remove the first exchange 2003 server. I have two Exchange 2003 servers. Thanks "hanna chalhoub" <hannac@newhorizons.com.lb> wrote: >Can anyone please send me information on how to remove the first exchange >2003 server. I have two Exchange 2003 servers. > >Thanks > The title's a bit off but this should contain all the steps you need: http://support.microsoft.com/default.aspx?scid=kb;en-us;307917 Mark Arnold MCSA MCSE+M MVP, FAQ: http://www.swinc.com/resource/exchange.htm Blog: http://www.msexchange.me.u...

Outlook 2007 Problem with sending first message
Hello, I have a strange problem with Outlook 2007. When i send a message, that message will be stuck in the Outbox. If i keep it there and sent another message, that message will be send without a problem. So the problem is that i always have to have one message in my Outbox in order to be able to sent messages out at all. If i delete all messages in the Outbox and then try to send a message the result is the same. I have to send the message a second time and the first message needs to be in the Outbox. Does anybody know a fix for that problem? ...

Finding One Value, Matching Three Criteria
This is the table that has the values that we are looking up: Gain 1.6 1.6 1.8 1.8 2.0 2.0 Sex S H S H S H Body Weight 400 17.4 19.2 18.4 20.5 19.5 21.8 410 17.7 19.6 18.8 20.9 19.9 22.2 420 18.0 19.9 19.1 21.3 20.2 22.6 430 18.3 20.3 19.4 21.6 20.6 23.0 440 18.7 20.6 19.8 22.0 20.9 23.4 450 19.0 21.0 20.1 22.4 21.3 23.8 This the area of the spreadsheet that contains the criteria to matc for the lookup: Sex Gain Body Weight Value ? H 1.8 430 ? S 1.6 450 ? Can someone tell me how to write a formula that will find the value i ...

Sales for outlook setup cant find server...
Hi, I have done a new install everything is now working great thanks to this newsgroup, i have one last problem though. I have loaded sales for outlook and when it comes to entering the server it say it can not find an instance of it? Although i can login over the net and my users can as well any ideas? Dan Dan, If you or anyone else has also had this problem and fixed it please let me know as I also can connect over the network and via the VPN but get the same errors when trying to connect. Regards Steven Goldsmith "Dan" <anonymous@discussions.microsoft.com> wrote...

find & return value
My first spreadsheet is a calendar of sorts with date in one column and value in next. Dates for different months are in different columns, so we have: Date (Jan)| Value| Date (Feb)| Value| Date (Mar)| Value| etc. My second spreadsheet references this "calendar" but the layout is not the same at all (so lookups probably can't work?). In this spreadsheet, I have a list of various dates from different months. What formula can I use to return the corresponding value for the date, based on the source info in my first spreadsheet? Sounds right for VLOOKUP to me. Layout is im...

outlook2003: can't find MaxFileSize registry entry
Hi! all, One of the users whom I support has reached the size limit for her .pst file. The KB #832925 tell me how to change the size limit but I was unable to find all entrys in the registry. I'm can't find 11.0 under HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\ in her windows or any of the other's that I support, and all them PC are windows xp sp2 + office 2003. Any suggestions? Thanks a lot! The instructions are not clear, you must create the key and values manually. For example if you expanded Microsoft and did not see an Office key, you would select/highlig...

Can't find all my contacts after O2007 reinstall
Please excuse a newbie here, spent the last couple of hours looking through the old posts but can't find the answer I need. Due to system instabilities I've had to format my C drive and reinstall Win 7 and of course everything else including Office 2007. Made a copy of my outlook.pst file and have successfully linked that backup up after reinstall of Office. All emails, folders, contacts etc are there. Everything looked good until trying to send an email and the contact I send to often did not appear. I have my contacts grouped under a bunch of different folders within ...

Where can I find my upgrade license key?
I have a Software Assurance license of CRM v1.2. I just downloaded the CRM v3.0 ISO's from MSDN... Where can I find MY (not the MSDN test key) license key for v3.0? (Or, When will they be available?) They were not available on my MBS Account. -- - Dan L. I expect them to appear in a matter of a few weeks "Dan L." <justsml@community.nospam> wrote in message news:B8DD4102-B514-4FBD-BFC5-2A5427E08451@microsoft.com... >I have a Software Assurance license of CRM v1.2. > I just downloaded the CRM v3.0 ISO's from MSDN... > Where can I find MY (not the MSDN test k...

Find Date Mailbox Created
Hello, In ADSIEdit you can see the whenCreated field, but this refers to the date the AD account was created. Does anyone know how to find the date the account was given a mailbox? We had AD long before Exchange and I'm trying to find out when people were given mailboxes precisely. Thanks. i struggled with this, too, and I don't believe there is any way to get this info...I miss having that at my fingertips... -- Susan Conkey [MVP] "GC Postmaster" <gc_postmaster@gordon.edu> wrote in message news:9662BF63-2EAF-4D29-B318-0861643E87A1@microsoft.com... > Hello...

finding address book for Outlook Express
I recently changed my boot hard drive and re-installed XP. After the installation I realized that I forgot to backup my address book for Outlook Express. Fortunately, the previous hard drive was still around, such that I could connect it to the machine. However, I could not find any WAB file, which was identified on Microsoft's web site as the address book for OE. Any suggestion? 'Folder Options|View' select "Show hidden files and folders", and try again. Hal -- Hal Hostetler, CPBE Senior Engineer/MIS -- MS MVP-Print/Imaging -- WA7BGX www.kvoa.com -- KVOA Television, T...

Can't find origination module
In GP 10, we have some invoices we need to delete - errors from when we just started up about a month ago. When we go to Transactions>>Sales>>Posted Transactions, we can bring up the invoice, but when we hit VOID, it gives us this message: "this transaction didn't originate in Receivables Management. Reversing entries will be made in Receivables Management and General Ledger only. Do you want to continue?" We hit NO because we don't want to screw up the system, but then we can't find the invoices anywhere else. We entered them in Transactions>>Sal...

Find and Replace 02-25-10
How do you replace a word with the same word except I want to change the Fonts of only one word in a cell? Then continue to change only that one word in 159 cells? This is not built into excel. But you can use a macro: Saved from a previous post: Option Explicit Option Compare Text Sub testme() Application.ScreenUpdating = False Dim myWords As Variant Dim myRng As Range Dim foundCell As Range Dim iCtr As Long 'word counter Dim cCtr As Long 'character counter Dim FirstAddress As String Dim AllFoundCells As Range Dim myCel...

Find a person
I have a workbook with a column like this: NAME/CLASS LASTNAME, FIRSTNAME (student's actual name goes here, all caps and BOLD) Wellness WRAP Picking Up The Pieces Understanding Your Medications Understanding Your Symptoms Anger Management LIFTT Supported Employment Basic Computer Intermediate Computer Adult Basic Education Creative Writing Sign Language Total Class Hours This list repeats many times down the column for different students. Currently I use Ctrl+F and type the first few letters of the last name to navigate to a particular student's class group. I'm considering a u...

Advanced find querying data from multiple tables.
Hello, Here's my specific senario. At our Office we would like to able to find all Contacts where the Account they belong to (Parent Account) is marked (radial button Yes/No) customer. The Account has the customer, vendor or reseller attibute because it is easier to mark one Account instead of every Contact belonging to that Account. Problem is from with in advance find on Contacts I can not select any fields belonging to Accounts. I don't want to use Crystal Reports because I hate it and there would be too many reports to create. Any ideas how to do this from CRM 1.2? Can this ...

Problem with Advanced Find
>Hello, any help would be very much appreciated. >On our original hard drive, all Microsoft outlook related >folders were located in the single file "mailbox.pst" >The hard drive encountered a virus, and the most recently >backed up "mailbox.pst" that wasn't infected, was copied >onto our new hard drive. >After loading outlook, onto the new hard drive, a whole >new set of "personal folders" was created. We then opened >the old "mailbox.pst"( by pressing File->open), and the >old folders appeared above the new p...

Find/Replace woes
I am trying to use the Edit/Find/Replace feature to change the contents of a select range of cells on my sheet. I select the ranges I'd like to search (and not the ones I do not want to search), click find, and it correctly finds all the fields I want to change. BUT when I click REPLACE ALL, it affects the WHOLE SHEET!! ... the items FOUND within the range I selected as well as those not listed as found at all. I have thousands of changes to make so I cannot just click through and approve every change. What is going wrong????? Thanks When you select your range and do a find ...

where do I find Publisher on Office Xp
I have the Office XP Porfessional upgrade CDs. How do I find an install Publisher 2002 from these CDs TIA Dave in Omaha Hi Dave in Omaha (anonymous@discussions.microsoft.com), in the newsgroups you posted: || I have the Office XP Porfessional upgrade CDs. How do I || find an install Publisher 2002 from these CDs Publisher is not on the Office XP Professional Ugrade CD's. -- Brian Kvalheim Microsoft Publisher MVP http://www.mvps.org/publisher This posting is provided "AS IS" with no warranties, and confers no rights. A small child turns to Ed, and exclaims: "Look! L...

Natural Language "keywords" in Advanced Find
I know how wonderful Natural Language can be, in advanced find, and am thrilled that "relative" date searches are back in OL2003. However, I want to save a search for all emails created 2 WEEKDAYS AGO, and am at a loss to what N.L. keywords are available to me. Is there a source list, anywhere, for what words are RECOGNIZED by the natural language in Outlook? You'll have to experiment and see what works. I have some keywords in various articles at slipstick.com and outlook-tips.net, but there isn't a master list. AFAIk, 'weekdays' is not one of the words outlook...

How do you Find Number of Columns when a column label = ""?
I have a row of column strings. To find the number of columns in row 1 I would use: Maxcol = sheets(1).Range("A1").End(xlToRight).Column However, if one of the column labels before the end is "" (empty) then the Maxcol stops there. How do you find the true number of columns if some of the column labels are "" but the last column label in the row exists? Do you have to loop through all 256 possible columns in a for loop checking for the end or is there a simpler way? Thanks for any help. Dennis One way: With Sheets(1).Cells(1, Columns.Count) ...

Finding Time of idle remote sessions(RDP) in windows XP
Hi, Is there any way i can find the time of idle remote session(RDP) in windows XP using powershell. Please help! Hi Rajeev, Plain TS or XenApp\Citrix? Martin "Rajeev" <s.rajeev3@gmail.com> wrote in message news:b4c8b150-79ff-4f0b-8d90-a13118c8eeda@z4g2000prh.googlegroups.com... > Hi, > > Is there any way i can find the time of idle remote session(RDP) in > windows XP using powershell. > > Please help! Its plain TS, using RDP In that case you should use Win32_LogonSession class and filter LogonType 10: http://msdn.microsoft....

(Outlook 2003) Contacts not show on "Find" tool
Hello, I have an issue for you. Everytime a delegate updates a contact (actualy makes a change and saves) on the delegated contacts folder, afterwards, the "Find" tool in Outlook is unable to find said contact. The contact is still there, when viewing the folder and scrolling through them. Using Exchange Server 2007 and Outlook 2003 on the client. Any help is welcome. Submitted via EggHeadCafe - Software Developer Portal of Choice Treeview Explorer / Dialog for SmartPhone http://www.eggheadcafe.com/tutorials/aspnet/3ee21d23-2b74-4f28-8c29-8f0336e05a0a/treeview-explor...

Find cell which returned maximum value in formula
-- De De, try this, =CELL("address",INDEX(A:A,MATCH(MAX(A:A),A:A,0))) will show the first one if there are more than one -- Paul B Always backup your data before trying something new Please post any response to the newsgroups so others can benefit from it Feedback on answers is always appreciated! Using Excel 2002 & 2003 "De" <De@discussions.microsoft.com> wrote in message news:A17DFFDA-BE05-463C-B68D-65FE235E6098@microsoft.com... > > -- > De Thanks, Paul, but I found this hard to follow. Excel kept returning that I had disabled macros but yo...