Open Recordset

T

ttthello

I am trying to write an "onClick" function for a button that will chec
whether a field in the form is a valid record in a table.

There are some error during compilation and I'm not sure if th
following is correct:

Private sub cmdSubmit_Click ()
Dim rst As Recordset
Set rst = CurrentDB.Openrecordset ("Select [field1] fro
Tablename")
rst.MoveFirst
Do
Debug.Print rst.MoveNext
Loop Until rst![Field1] = Me!Fieldname
DoCmd.OpenForm ("New Form")

End Su
 
G

Guest

----- ttthello wrote: ----


I am trying to write an "onClick" function for a button that will chec
whether a field in the form is a valid record in a table

There are some error during compilation and I'm not sure if th
following is correct

Private sub cmdSubmit_Click (
Dim rst As Recordse
Set rst = CurrentDB.Openrecordset ("Select [field1] fro
Tablename"
rst.MoveFirs
D
Debug.Print rst.MoveNex
Loop Until rst![Field1] = Me!Fieldnam
DoCmd.OpenForm ("New Form"

End Su


-----------------------------------------------



Hi ttthello, what are you trying to acheive in the line

Debug.Print rst.MoveNex



You can't print a recordset move..

Luc
Jonathan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top