Help With Find First Method

Help With Find First Method

Post by paul » Thu, 15 Jul 1999 04:00:00



Private Sub Find_Click()
Dim varHomePhone As Variant

With Me.Data1.Recordset
.FindFirst "HomePhone=" & varHomePhone
End With

End Sub

Help I keep getting runtime error 3077  " Syntax error (Missing operator in
expression)
What I am trying to do is find the record with the same phone number and
display it to the screen.
Thanks for any help.

 
 
 

Help With Find First Method

Post by Jim in Clevelan » Thu, 15 Jul 1999 04:00:00



> Private Sub Find_Click()
> Dim varHomePhone As Variant

> With Me.Data1.Recordset
> .FindFirst "HomePhone=" & varHomePhone
> End With

> End Sub

> Help I keep getting runtime error 3077  " Syntax error (Missing operator in
> expression)
> What I am trying to do is find the record with the same phone number and
> display it to the screen.

  The syntax you're using assumes that the db table field for HomePhone
is a Number DataType field.  In Access, people often want the input
mask, or want to store phone numbers with "punctuation" such as
parentheses around area code and hyphen between prefix and final 4
digits - thus, phone number fields are often set to Text DataType.  On
the off-chance that's true for your app, try treating your variable as
Text:

 .FindFirst "HomePhone='" & varHomePhone & "'"

--
Jim in Cleveland
If you're writing to me, in my address
change "REAL_Address.see.below" to "worldnet.att.net"

"What's so funny 'bout peace, love & understanding?"
     - Nick Lowe

 
 
 

1. Help Please - .Find method will not return the first value in a table

I am having trouble with Find method.  If I search for an item in a table
that happens to be the first item (record) in the table, it does not find it
and returns ".EOF = True"  Any help would be greatly appreciated

NB: If I set the SkipRecord (the 1) parameter in this line ...

"ado_rsPayTable.Find strCriteria, 1, adSearchForward"

... to 0 I get the error message "The rowset cannot scroll backwards".

The code is...

Dim ado_dbUserDatabase As New ADODB.Connection
Dim ado_rsPayTable As New ADODB.Recordset
Dim strCriteria As String

Set ado_dbUserDatabase = New ADODB.Connection
ado_dbUserDatabase.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
g_uSetup.sUserDatabase

Set ado_rsPayTable = New ADODB.Recordset
ado_rsPayTable.Open gc_sPAYTYPE_TABLE, ado_dbUserDatabase,
adOpenForwardOnly, , adCmdTable

strCriteria = "PayType = " & "'" & sPayType & "'"
ado_rsPayTable.Find strCriteria, 1, adSearchForward

CheckPayType = Not ado_rsPayTable.EOF

ado_rsPayTable.Close
Set ado_rsPayTable = Nothing

ado_dbUserDatabase.Close
Set ado_dbUserDatabase = Nothing

Thanks for your help

Regards Richard
---
Richard Bourne

2. Sr. SYBASE DBA/IL-ALSIP

3. Find First, Find Next, Find Previous, Find Last

4. select record between 2 day

5. find first method

6. optimizer won't pick bitmap index

7. Field Names containing Spaces and the Find First method

8. Help, Foreign keys and Index Keys

9. HELP: First Day in Week Setting and First Week in Year Help

10. Find First Date Plus - Please Help

11. VB4,pro. Need help width find first

12. Please, Oh Please Help Find first date plus

13. Query help with finding first and last values in a day