09-06-06, 16:11 #1Registered User
- Join Date
- Sep 2006
Unanswered: Runtime Error '3021' - No Current Record ?
Im using MS Access 2003 (on a Access 2000 dbase file) . Im new to VBA programming and Access use and so am getting the following error:
Runtime Error '3021'
No Current Record
on the following:
Private Sub Form_Open(Cancel As Integer)
SetJobGroupID (Me.Recordset.Fields("Job Group").Value)
My form contains several controls on it include the combo box control "Job Group". It's Control Source = "Job Group" and Row Source Type = Table/Query. What I'm expecting to get back is before the form is shown the control will be populated with the "Job Group" field, one of the fields belonging to the Form's Row Source. I then grab this value and pass it to my SetJobGroupID subroutine to store it into a global variable for later use within a WHERE clause.
This method works for other forms but not this form for some reason.
09-06-06, 22:04 #2Moderator
- Join Date
- Dec 2004
- Madison, WI
You may have success by putting your Form_Open code into the button which is clicked to open the form and after the docmd.openform "xxxx". Just a quick thought but it may not work (you'll of course, have to change a few things such as the me. to Forms!MyForm....etc...)Expert Database Programming
MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)