Help with Set rst =

Don White

Spider
Local time
Today, 09:19
Joined
Jan 6, 2005
Messages
17
I am new at VB, but learning.

The following code (part of the code) give gives me an error (Compile Error: Method or data member not found:

Dim rst As Recordset
Dim rst2 As Recordset
Dim dbs As Database
Set dbs = CurrentDb
dbs.Execute ("DELETE * FROM Groupfile") 'empty table for new data

Set rst = dbs.OpenRecordset("Select * from old where groupname = " & Me.groupname)
Set rst2 = dbs.OpenRecordset("select * from groupfile where groupname = " & rst!groupname)
rst2.AddNew
rst2!groupno = tst!groupno
rst2!groupname = rst!groupname
rst2!new = rst!new
......

The error defines me.groupname as the error field. This field is defined in both old anf GroupFile tables. It must be the format, but I cannot detect what is wrong.

Please help.

Thanks in advance.

:confused:
 
Don,

Change:
Set rst = dbs.OpenRecordset("Select * from old where groupname = " & Me.groupname)

To:
Set rst = dbs.OpenRecordset("Select * from old where groupname = '" & Me.groupname & "'")

The end-result is that you present something like:

Select * from old where groupname = 'TestGroup'

If groupname is a TEXT field and Me.GroupName is a control on your form,
that should fix it.

hth,
Wayne
 

Users who are viewing this thread

Back
Top Bottom