By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,124 Members | 2,027 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,124 IT Pros & Developers. It's quick & easy.

Displaying Recordset

P: n/a
Hi all,
I am new to access and I got a simple question
How can I display matching a row from a table?
I have:
Function test2()

Dim loDB As Database
Dim loRSPlayer As Recordset
Dim lnIndex As Integer
Dim lnCount As Integer
Set loDB = CurrentDb

Set loRSPlayer = loDB.OpenRecordset("HandGroup")
' add
With loRSPlayer
.FindFirst "Card1 = "
.Close

End With
End Function

It is complaining that object doesn't support this peration. I can add
new record with .AddNew (same dims). Can you help?

Thx

May 21 '06 #1
Share this Question
Share on Google+
7 Replies


P: n/a
pe****@syr.edu wrote in
news:11**********************@j55g2000cwa.googlegr oups.com:
Hi all,
I am new to access and I got a simple question
How can I display matching a row from a table?
You create a bound form. That may sound flippant, but the form
opens the recordset, transfers the field values to the controls
on the form.

If you want to emulate the process with an unbound form, you are
spending effort for nothing.

BTW, .FindFirst "Card1 = " is missing the value to find,
which may explain the error message

It should be .FindFirst "Card1 = " & somevariable 'if numeric
or .FindFirst "Card1 = """ & somevariable & """" 'if text
or .FindFirst "Card1 = $" & somevariable & "#" 'if datetime

I have:
Function test2()

Dim loDB As Database
Dim loRSPlayer As Recordset
Dim lnIndex As Integer
Dim lnCount As Integer
Set loDB = CurrentDb

Set loRSPlayer = loDB.OpenRecordset("HandGroup")
' add
With loRSPlayer
.FindFirst "Card1 = "
.Close

End With
End Function

It is complaining that object doesn't support this peration. I
can add new record with .AddNew (same dims). Can you help?

Thx


--
Bob Quintal

PA is y I've altered my email address.
May 21 '06 #2

P: n/a
I tried :

Function test2()

Dim loDB As Database
Dim loRSPlayer As Recordset
Dim lnIndex As Integer
Dim lnCount As Integer
Dim lsCard As String

lsCard = "K"
Set loDB = CurrentDb

Set loRSPlayer = loDB.OpenRecordset("HandGroup")
' add
With loRSPlayer
.FindFirst "Card1 = """ & lsCard & """"
.Close

End With
End Function

Still getting same error msg.

May 21 '06 #3

P: n/a
pe****@syr.edu wrote in news:1148238273.942390.95750
@j73g2000cwa.googlegroups.com:
I tried :

Function test2()

Dim loDB As Database
Dim loRSPlayer As Recordset
Dim lnIndex As Integer
Dim lnCount As Integer
Dim lsCard As String

lsCard = "K"
Set loDB = CurrentDb

Set loRSPlayer = loDB.OpenRecordset("HandGroup")
' add
With loRSPlayer
.FindFirst "Card1 = """ & lsCard & """"
.Close

End With
End Function

Still getting same error msg.


When you step through the code (using the F8 key), which line
triggers the error message?

--
Bob Quintal

PA is y I've altered my email address.
May 21 '06 #4

P: n/a
at ".FindFirst"

Thx for reply

May 21 '06 #5

P: n/a
I see no place where you do anything that would display the record, either
in this post or your follow-up. If you have a Form open that has its
RecordSource the same as the "HandGroup" (table or query) that you use here,
you could use its RecordsetClone to find the appropriate record, and set
Bookmarks to show that record on the form.

On your second response, that is still the case... you've done nothing to
display the Record, even if it did work to find it. Are you certain that the
Field is actually named Card1? Did you try enclosing the Card1 in square
brackets, e.g. "[Card1] = """...?

Larry Linson
Microsoft Access MVP
<pe****@syr.edu> wrote in message
news:11**********************@j55g2000cwa.googlegr oups.com...
Hi all,
I am new to access and I got a simple question
How can I display matching a row from a table?
I have:
Function test2()

Dim loDB As Database
Dim loRSPlayer As Recordset
Dim lnIndex As Integer
Dim lnCount As Integer
Set loDB = CurrentDb

Set loRSPlayer = loDB.OpenRecordset("HandGroup")
' add
With loRSPlayer
.FindFirst "Card1 = "
.Close

End With
End Function

It is complaining that object doesn't support this peration. I can add
new record with .AddNew (same dims). Can you help?

Thx

May 22 '06 #6

P: n/a
Yes, I have "Card1" field in "HandGroup" table. I have no idea why this
isn't working.
Yes I didn't code anything for "displaying", that's second thing in my
mind now :)
Would you show me how to do it

thx

May 22 '06 #7

P: n/a
Set loRSPlayer = loDB.OpenRecordset("HandGroup", dbOpenDynaset)

----
Would you tell us how you want to show it?
message box?
form?
report?
datasheet?
....
etched in blood on your desk?

How?

May 22 '06 #8

This discussion thread is closed

Replies have been disabled for this discussion.