PC Review


Reply
Thread Tools Rate Thread

FindFirst when field is Long Integer

 
 
=?Utf-8?B?RWQgQmxvb20=?=
Guest
Posts: n/a
 
      16th Mar 2006
How do I use the .FindFirst method when the field I need to search is a Long
Integer?

..FindFirst Me.ID

ID is Long Integer

Thank you in advance.
 
Reply With Quote
 
 
 
 
=?Utf-8?B?S2xhdHV1?=
Guest
Posts: n/a
 
      16th Mar 2006
The only difference for data type is the syntax.
Text field criteria must be enclosed in single or double quotes.
Date field criteria must be enclosed in #
Numeric field criteria uses no delimiters.

In any case, your syntax included what you want to find but does not include
where you want to find it. The correct syntax is:

..FindFirst "[FieldNameToSearch] = " & Me.ID

If ID were text
..FindFirst "[FieldNameToSearch] = '" & Me.ID & "'"

If ID were a date
..FindFirst "[FieldNameToSearch] = #" & Me.ID & "#"



"Ed Bloom" wrote:

> How do I use the .FindFirst method when the field I need to search is a Long
> Integer?
>
> .FindFirst Me.ID
>
> ID is Long Integer
>
> Thank you in advance.

 
Reply With Quote
 
Corey-g via AccessMonster.com
Guest
Posts: n/a
 
      16th Mar 2006
You don't. the .findfirst method is used with recordsets, not fields. What
are you trying to do?

Ed Bloom wrote:
>How do I use the .FindFirst method when the field I need to search is a Long
>Integer?
>
>.FindFirst Me.ID
>
>ID is Long Integer
>
>Thank you in advance.


--
Message posted via http://www.accessmonster.com
 
Reply With Quote
 
Corey-g via AccessMonster.com
Guest
Posts: n/a
 
      16th Mar 2006
Well, I guess i was wrong- I've never used it like that before...

Corey-g wrote:
>You don't. the .findfirst method is used with recordsets, not fields. What
>are you trying to do?
>
>>How do I use the .FindFirst method when the field I need to search is a Long
>>Integer?

>[quoted text clipped - 4 lines]
>>
>>Thank you in advance.


--
Message posted via http://www.accessmonster.com
 
Reply With Quote
 
Zedbiker
Guest
Posts: n/a
 
      29th Nov 2007
Private Sub CmbDate_AfterUpdate()

Dim rs As Object
Dim stDocName As String
Dim stLinkCriteria

stDocName = "Fault Log"
DoCmd.ShowAllRecords
Set rs = Me.Recordset.Clone
rs.FindFirst "[DateReported] = #" & Me.CmbDate & "#"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
stLinkCriteria = "[DateReported]= #" & Me.CmbDate & "#"
DoCmd.Close
DoCmd.OpenForm stDocName, , , stLinkCriteria

End Sub
Used this method to search for a date and filter the records. It worked
well. Thanks for that. However when the date starts with a zero eg.
01/10/2006 for some reason it can't find the date. It will find any other
date with no problem.
Many thanks for any help.

"Klatuu" wrote:

> The only difference for data type is the syntax.
> Text field criteria must be enclosed in single or double quotes.
> Date field criteria must be enclosed in #
> Numeric field criteria uses no delimiters.
>
> In any case, your syntax included what you want to find but does not include
> where you want to find it. The correct syntax is:
>
> .FindFirst "[FieldNameToSearch] = " & Me.ID
>
> If ID were text
> .FindFirst "[FieldNameToSearch] = '" & Me.ID & "'"
>
> If ID were a date
> .FindFirst "[FieldNameToSearch] = #" & Me.ID & "#"
>
>
>
> "Ed Bloom" wrote:
>
> > How do I use the .FindFirst method when the field I need to search is a Long
> > Integer?
> >
> > .FindFirst Me.ID
> >
> > ID is Long Integer
> >
> > Thank you in advance.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing an AutoIncrement Field to a Long Integer Field and Back Don Microsoft Access External Data 3 9th Dec 2005 04:23 AM
Changing an AutoIncrement Field to a Long Integer Field and Back Don Microsoft Access Database Table Design 3 9th Dec 2005 04:23 AM
Date field appear as long integer John D via AccessMonster.com Microsoft Access External Data 2 28th Nov 2005 07:02 PM
long integer field (AutoNumber) michael@go-on-line.de Microsoft Access 4 5th Oct 2005 11:28 AM
Can't create Integer field, a Long Integer is created instead? cbu Microsoft Access Database Table Design 1 2nd Jan 2004 05:58 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:31 PM.