Open Recordset

  • Thread starter Thread starter ttthello
  • Start date Start date
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
 
----- 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
 
Back
Top