
Need help with accessing recordset data
As hai suggests, include in your code the step to set the object variable
dbcurrent to be your current database.
--
Hoping that this is helpful...
Ken Snell
<MS ACCESS MVP>
Quote:
> Thanks but that didn't help. I double checked my query btw to make sure
> the field was spelled correctly. Here's the sqlview source code of the
query
> SELECT tblCategories.Category_ID, tblSubcategories1.SubCategory1_ID,
> tblSubcategories2.Subcategory2_ID
> FROM tblSubcategories1, tblCategories, tblSubcategories2
> WHERE (((tblCategories.Category_Type)=[Forms]![frmAdd Categories and
> Subcategories]![cboCategory]) AND
> ((tblSubcategories1.SubCategory1_Type)=[Forms]![frmAdd Categories and
> Subcategories]![cboSubCategory1]) AND
> ((tblSubcategories2.Subcategory2_Type)=[Forms]![frmAdd Categories and
> Subcategories]![cboSubcategory2]));
> Any other ideas?
> >Use the bang (!) operator instead of the dot (.) operator.
> > rst!Category_ID
> >--
> >Hoping that this is helpful...
> > Ken Snell
> ><MS ACCESS MVP>
> >>I'm using access2000. On a form I have a command button to run the
> >>following code. When the code runs I get the error Method or Data member
> >>not found on the code in blue. Can anyone tell me what I'm doing wrong?
> >>Private Sub cmdUpdate_Click()
> >>On Error GoTo Err_cmdUpdate_Click
> >> Dim stDocName As String
> >> Dim dbCurrent As Database
> >> Dim qdf As QueryDef
> >> Dim rst As Recordset
> >> Dim str As String
> >> Dim strInsert As String
> >> Dim strValues As String
> >> Set qdf = dbCurrent.QueryDefs("qryLookupIDs")
> >> Set rst = qdf.OpenRecordset(dbOpenDynaset)
> >> strInsert = "Insert Into [tblLinked_Categories] "
> >> strValues = "Values (" & rst.Category_ID & ", " &
> >>rst.Subcategory1_ID & ", " & rst.Subcategory2_ID
> >> strValues = strValues & ");"
> >> str = strInsert & strValues
> >> Debug.Print str
> >> 'dbCurrent.Execute str, dbFailOnError
> >> Set dbCurrent = Nothing
> >>Exit_cmdUpdate_Click:
> >> Exit Sub
> >>Err_cmdUpdate_Click:
> >> MsgBox Err.Description
> >> Resume Exit_cmdUpdate_Click
> >>End Sub