FindFirst with numeric field

For some reason I'm having a lot of problems getting a findfirst to work.  
First I tried comparing to a text field but that didn't work.  Now I'm trying 
to compare to a numeric field (ID) but that's not working either.  The first 
line is I believe correct for a text field.  What is the correct syntax if 
the field is numeric?  Thanks for any help on this.

rsCategories.FindFirst "ID = '" & Category & "'"


rsCategories.FindFirst "ID = "  ????????
0
Utf
1/3/2010 9:54:01 PM
access.modulesdaovba 1670 articles. 0 followers. Follow

4 Replies
1014 Views

Similar Articles

[PageSpeed] 37

rsCategories.FindFirst "ID = " & Category


-- 
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)



"dhstein" <dhstein@discussions.microsoft.com> wrote in message 
news:4EB49C30-0908-4A9E-85BA-7106AE67B25C@microsoft.com...
> For some reason I'm having a lot of problems getting a findfirst to work.
> First I tried comparing to a text field but that didn't work.  Now I'm 
> trying
> to compare to a numeric field (ID) but that's not working either.  The 
> first
> line is I believe correct for a text field.  What is the correct syntax if
> the field is numeric?  Thanks for any help on this.

0
Douglas
1/3/2010 10:00:29 PM
Thanks Doug.  I still can't get the find to work , that is to find the 
record.  The record definitely exists.  ID is an autonumber field.  I'm 
testing with a value of 10 which is in the table.  The Category variable is 
Dimensioned as Integer.  I think I'm having some problems with data typing.  
Either I get a "not found" condition or a type fields mismatch.

"Douglas J. Steele" wrote:

> rsCategories.FindFirst "ID = " & Category
> 
> 
> -- 
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no e-mails, please!)
> 
> 
> 
> "dhstein" <dhstein@discussions.microsoft.com> wrote in message 
> news:4EB49C30-0908-4A9E-85BA-7106AE67B25C@microsoft.com...
> > For some reason I'm having a lot of problems getting a findfirst to work.
> > First I tried comparing to a text field but that didn't work.  Now I'm 
> > trying
> > to compare to a numeric field (ID) but that's not working either.  The 
> > first
> > line is I believe correct for a text field.  What is the correct syntax if
> > the field is numeric?  Thanks for any help on this.
> 
> .
> 
0
Utf
1/3/2010 11:15:01 PM
Any chance you're working with a linked table?

-- 

Regards

Jeff Boyce
Microsoft Access MVP

Disclaimer: This author may have received products and services mentioned in
this post. Mention and/or description of a product or service herein does
not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.

"dhstein" <dhstein@discussions.microsoft.com> wrote in message 
news:4EB49C30-0908-4A9E-85BA-7106AE67B25C@microsoft.com...
> For some reason I'm having a lot of problems getting a findfirst to work.
> First I tried comparing to a text field but that didn't work.  Now I'm 
> trying
> to compare to a numeric field (ID) but that's not working either.  The 
> first
> line is I believe correct for a text field.  What is the correct syntax if
> the field is numeric?  Thanks for any help on this.
>
> rsCategories.FindFirst "ID = '" & Category & "'"
>
>
> rsCategories.FindFirst "ID = "  ???????? 


0
Jeff
1/3/2010 11:40:05 PM
since autonumbers are generally long integer, I'd define your Category 
variable as long, not Integer.

What is the rest of the code in this sequence?

Are you certain that rsCategories contains the ID field?

I usually use FindFirst with a recordset clone, followed immediately by a 
test of no match, something like:

Dim rs as DAO.Recordset

Set rs = rsCategories.recordsetclone 
rs.FindFirst "[ID] = " & Category
if rs.nomatch = true then
    msgbox "No match was found!"
else
    rsCategories.bookmark = rs.bookmark
endif


----
HTH
Dale



"dhstein" wrote:

> Thanks Doug.  I still can't get the find to work , that is to find the 
> record.  The record definitely exists.  ID is an autonumber field.  I'm 
> testing with a value of 10 which is in the table.  The Category variable is 
> Dimensioned as Integer.  I think I'm having some problems with data typing.  
> Either I get a "not found" condition or a type fields mismatch.
> 
> "Douglas J. Steele" wrote:
> 
> > rsCategories.FindFirst "ID = " & Category
> > 
> > 
> > -- 
> > Doug Steele, Microsoft Access MVP
> > http://I.Am/DougSteele
> > (no e-mails, please!)
> > 
> > 
> > 
> > "dhstein" <dhstein@discussions.microsoft.com> wrote in message 
> > news:4EB49C30-0908-4A9E-85BA-7106AE67B25C@microsoft.com...
> > > For some reason I'm having a lot of problems getting a findfirst to work.
> > > First I tried comparing to a text field but that didn't work.  Now I'm 
> > > trying
> > > to compare to a numeric field (ID) but that's not working either.  The 
> > > first
> > > line is I believe correct for a text field.  What is the correct syntax if
> > > the field is numeric?  Thanks for any help on this.
> > 
> > .
> > 
0
Utf
1/4/2010 8:30:01 PM
Reply:

Similar Artilces:

Problem inserting fields into subreport...
I have a report that has a subreport in it. The subreport has two fields that store a value that tracks the status of map changes. We have digital maps and paper maps and need to track the status of a change as to whether or not it has been done on the paper maps and/or the digital maps. I want the report to show the verbose meaning of these values (stored in a separate table). Let me set this up a bit... Table: MapChange Field: ChangeID Field: Description Table: ChangeDetail Field: DetailID Field: ChangeID (links this detail to MapChange.ChangID - the MapChange can have ma...

How can I set one field to return data into another field?
OK here goes, hope this is clear I am wanting to set up a database where info is selected in one field and then multiple fields are populated. EG entering username from drop down list automatically fills in Name, Dept and Ext so save looking all those up each time. In excel I would use the lookup function and put formulae in each cell. Is this possible in access? Any help greatly appreciated. -- Thanks Terri No need to populate all those fields in a second table. Just enter EmployeeID using a combo sourced from Employee table and join the Employee table in your query th...

CSV numeric strings
I'm having a little "fun" creating a CSV file from an ASP page for use with Excel and hope someone here knows of a trick that doesn't involve user intervention. I am familiar with the format of CSV files - strings containing a comma must be enclosed with double quotes, otherwise just separate all the columns with a comma. But ... Excel tries to be smart about things. If a string, quoted or unquoted, contains leading spaces and/or trailing spaces and/or leading zeros and is otherwise numeric (number groupings, decimal points, positive/negative sign, currency sign, and the c...

Yes/No Field
I have fields in the backend table that are set for YES/NO on type. However, my users just want to use a Y for YES or N for No, instead of having to keystroke the entire "YES" in the field on the Frontend database. Is there an easy way to just enter an Y or N for controls using the Yes/No field type? HI - Did you consider using checkboxes for these fields instead of textboxes? It doesn't change how the data is stored in the tables. A Yes/No is stored as 0 or -1 = "Yes" or "No" is just a display format. If your users don't like having to...

Searchable text field
I have created a work sheet to track what daily tasks my employees do on a job. I have numerous employees, each doing several tasks. I want to have a "Notes" column where I can document any special conditions that may have existed when the work was performed. For example, Al painted a room and Bob installed floor tile. I can document the work tasks, but I need to document if painting was done on a cloudy day or the floor was bumpy. Then, I would like to search the "Notes" column for all work done on a cloudy day, etc. Any suggestions? Thanks, Bill Hi! Defi...

How to clear the names when writing in the To: field...
Hi, How can I clear the list of names, that's showing up when I write in my To:/CC: field. Everytime I send an email to someone, they get's listed in this list - which means, everytime I write a name, I get a huge list... How can I avoid this? Thanks! /Rico After you type 3 letters in the To:/CC: box the names appear in the dropdown. If you use the down arrow to highlight the name you don't want to appear and then press the delete key. Hey preseto its gone. >-----Original Message----- >Hi, > >How can I clear the list of names, that's showing up when &...

Is it possible to get field description in Access using ASP
I am trying to get data from an Access database using asp. I can grab the field names in a table, but do not know how to grab the field descriptors. Is it possible to do this, and if so, how please? Hi Chris What is a field descriptor ? -- Wayne Manchester, England. "ChrisChapman" wrote: > I am trying to get data from an Access database using asp. I can grab the > field names in a table, but do not know how to grab the field descriptors. Is > it possible to do this, and if so, how please? ...

RM00104
I'm developing an SSRS report for AR, and I am looking to find out what the HISTTYPE field in RM00104 means. There are records where HISTTYPE= both 0 and 1 in this table, and I would like to know what distinguishes 1 from 0. Jessica, From http://victoriayudin.com/gp-reports/rm-tables/: HISTTYPE - History Type in RM00104: 0 - Calendar 1 - Fiscal -- Victoria Yudin Dynamics GP MVP Flexible Solutions - home of GP Reports http://www.flex-solutions.com/gpreports.html blog: www.victoriayudin.com "Jessica" <Jessica@discussions.microsoft.com> wrote in message news:2A002...

combining fields
Hi I have a table called tblDetails and in this table there are 2 field called strGateID (autonumber) and srtPN which is a default value of PN. I have combined two field in a query called qrySearch and the new field is called srtSearchNo. On my main page frmMain I have a listbox (lstSearch) this displays all the data in the tblDetails via the qrySearch. When I double click on a record in the list box I wish it to display all the relevant date on a new form called frmResults. Private Sub ShowRecord_Click() 'Find a selected record, then close the search dialog box DoCmd.OpenForm &quo...

Numeric convertion
Dear All How can convert Numeric figures to English text format in MS excel 2007. Pls help me in this topic Select the cell(s) that you wish to change. Home / Font / single left hand click on the arrow that appears in the lower right hand corner / Format Cells launches / Number tab / select Text and hit OK. "mubarak" wrote: > Dear All > How can convert Numeric figures to English text format in MS excel > 2007. Pls help me in this topic > This converts a number, say 45, into the text string "45". If mubarak intended to convert the number to the strin...

change numeric value in primary key
I have a table that has an auto number primary key. I want to renumber my records beginning at number 1. Because I've deleted some records from years ago, the first record in my table begins with 4587. I currently have 1587 records in my table. Is there a way to do this quickly? SITCFanTN - You can do this quickly if this is the ONLY table that contains these numbers. If you have any other related tables with this number in them, then you will need a more complex method to keep the data in sync. In any case, back up your data before you make changes like this! The ...

Add Calculation Field In Query
I hv this sql SELECT Qtskssubcat2.BRNCD, Qtskssubcat2.BRANCH, Qtskssubcat2.SUBCATDESC2, Sum(Qtskssubcat2.Netbal1MIA) AS SumOfNetbal1MIA, Sum(Qtskssubcat2.Netbal2MIA) AS SumOfNetbal2MIA, Sum(Qtskssubcat2.Netbal3MIA) AS SumOfNetbal3MIA, Sum(Qtskssubcat2.Netbal4MIA) AS SumOfNetbal4MIA, Sum(Qtskssubcat2.Netbal5MIA) AS SumOfNetbal5MIA, Sum(Qprevmthsubcat2.Netbal1MIA) AS SumOfNetbal1MIA1, Sum(Qprevmthsubcat2.Netbal2MIA) AS SumOfNetbal2MIA1, Sum(Qprevmthsubcat2.Netbal3MIA) AS SumOfNetbal3MIA1, Sum(Qprevmthsubcat2.Netbal4MIA) AS SumOfNetbal4MIA1, Sum(Qprevmthsubcat2.Netbal5MIA) AS S...

Question on mapping item table fields when loading items from a fi
I am trying to load an item file from a distributor into RMS. I am confused about where to put the UPC code and the item number. IF I put this Distributors item code, for example ESTT1434 for a certain moodel rocket starter set, in the Item Lookip Code field, where do I put the UPC code? I read on some threads here where Some people said put the UPC code in the ILC field, but then where does the item code go? Mark, Most enter the UPC into the Alias database. Some use the UPC as their ILC, then it becomes the "item code". Disty's code for the item goes into the Supplie...

CDaoRecordset::FindFirst() usage
As a novice on database, I am trying to use CDaoRecordset::FindFirst() function just to check if certain 'Serial Number' exists in other table but it throws following error: Error(3077): Syntax error (missing operator) in expression. Please see following code: .... ASSERT(m_pDB->IsOpen()); CDaoTableDef td(m_pDB); CDaoRecordset rs(m_pDB); // convert serial number string to long number char *end; long UnitNum=lstrtol(GetSerialNum(),&end,10); BOOL faulty = FALSE; try { td.Open((LPCTSTR)(_T("Table 1"))); } catch (CDaoException* e) { m_pView->DisplayD...

Numeric or Alpha
I am just starting to build a table, i have a RefNo which must always be 10 numbers long, so I have set the field as numeric. Some of these RefNo's begin with a "0" or even "00", after i have put them in the first 0's dissapear. The field is set as numer does this mean i will have to set the field as text so that the first 0's appear and hold in place.? or is there something i can do to force the 0 to stay in place and still keep the field numeric. I also need to ensure that there are always 10 digits in the RefNo field, with any missing numbers bei...

Data Fields being merged
Everything I have researched and tried has not worked in regards to merging the data from two data sheets. I am trying to compare the data from two sheets, merge the data so there is no duplication of data in each field and create a new data sheet that includes text, not just numerical data. Is there an easy button? Are there any automation tools? -- The world is on big picture! ...

auto populate fields in the form based on lookup record
Does anyone know how to (or what you need to do to) automatically populate fields in a form with the values from parent entity based on the lookup value you select in CRM4.0? For example, if I select a record from a lookup list/table, I want other fields in the form to be auto filled with related data from the lookup record I selected. I know CRM has mapping functionality but this is only applicable if you are creating a record from the parent. I need similar functionality of mapping but from choosing a lookup value. -- JL You need to access the CRM web services to achieve this. Se...

Modified By and Modified On fields
I am trying to customize a phone form (will need to do the same to most others) by adding Modified By and Modified On fields. After publishing the form, the fields appear on the form just fine but the lookup to a user list is greyed out. Any ideas? Am I doing something wrong? I found the answer myself. Those are system-generated values and. therefore, cannot be modified by a user "mkatsev" wrote: > I am trying to customize a phone form (will need to do the same to most > others) by adding Modified By and Modified On fields. After publishing the > form, the fields ap...

findfirst
I have a form with 6 fields on it, some text boxes and some combo boxes. The first box is a combo box of names. The second box is the person's ID number. I have set up a findfirst method so that when you select a name from the first box, the id for that person shows in the second box (if that person is in the list). The rest of the boxes on the form are more info on that person. I want those fields to fill in as well as the ID field when I select the name from the first box. I can't seem to figure out the code. I keep getting the id number in all the fields after I select the na...

Getting populated fields to automatically skip to the next field
Hello, I've got a working form and after entering data for each field, I press tab and it skips to the next field which is working okay, But, I'd prefer it to automatically skip after I have entered the correct data for each field without doing the above. Is there an easy way to accomplish this without getting to detailed? Also, How can I make the Enter key work on the last field in the form? Right now, I have to use the Tab key on the last field also to end the record. Thanks for any help in advance. -- Best regards, Donald Ramer donaldramer@comcast.net ?You want Acce...

Color
Hallo! My english isn't the best, but I hope that's good enough to understand. Is it possible to change the color of a simple edit-field?! I was searching, but I couldn't find anything. And simple the whole edit-field, no single row, or single word, the whole one. ((Something like "..SetTextColor(m_Edit1, GREEN)..")) I don't know?! For every meaningful answer: ThankYou! bye, martin Hi, try this from codeguru: http://www.codeguru.com/Cpp/controls/editctrl/backgroundcolor/article.php/c3929/ Guido You can change the entire background and all the text by subc...

Adding to a "Template" Table (only established fields)
I just thought of a possible solution, but I would need to know if it seems viable from someone.... How about in my case, I just create an empty (Null) field in my data table (the one that came from Excel), and I create a field of the same type (text) in the template table. I then run an update query and creat a join between the two tables with the blank fields....and choose the option to include ALL records from the data table and only those where the template table are equal. Would that trick access into running my append the way I want? Thanks again for a response, I am needing t...

Form Fields
I am creating a data entry form that contains 2 controls: one is a combo box and the other is a list box. I am populating the control box using the .AddItem method (property?) during the Form.Initialize Event and have successfully accomplished this. The list box is intended to be a dynamic list based on whichever choice is selected in the ComboBox. All the data is listed in 2 rows of a single worksheet - PartsList!A:B. Column A contains the Customer Name which would correspond with the value selected in the Combobox and Column B contains the Part Number. I know I could programmical...

Identifying missing numerical values in a series
In column A I have a series of numbers running from 1001 to 9078. These numbers run in numerical order, but there are known missing values. For example, the numbers may run 1000, 1001, 1005. In this instance the missing numbers are 1002, 1003 and 1004. It is these missing numbers that I need to identify from the column of numbers running from 1001 to 9078. Could these missing numbers be placed in column C. Any help would be greatly appreciated. Try the below array formula. This will be a bit slow...so try with a smaller range for testing as below..Please note that this is an...

How to imbed a cell reference in a text field?
Is there a way to imbed the value in a cell in a text field? Something like: "Cost at [E7] / hour.", where "[E7]" gets replaced by the value in cell E7. Thanks -- Running Excel 2000 SP-3 on Windows 2000 On Thu, 14 Dec 2006 05:48:30 -0800, LurfysMa <invalid@invalid.invalid> wrote: >Is there a way to imbed the value in a cell in a text field? > >Something like: "Cost at [E7] / hour.", where "[E7]" gets replaced by >the value in cell E7. I found the answer. Use the concatenate function: =CONCATENATE("Cost at $",E7,"...