Firstly, apologies as I am sure this will have been posted many times before but,
I have taken over a voluntary task of entering paintings into a database for an local art club's exhibition.
All paintined entered andthe selected ones for hanging numbered.
Last job is to produce an index of artists.
The query runs but then ends with the 2105 run time error above.
The visual basic highlights a line of code but I have absolutely NO experience of visual basic so I'm stumped.
The Index that has been produced up to the error gives the wrong paintings against some of the artists.
I would be greatful for ANY help at all but please remember I am NOT a programmer myself.
below is the code showing the highlighted line.
Any help very great fully received.
Thanks
Lisa
Private Sub Command9_Click()
DoCmd.OpenQuery "DeleteCatalogueT"
Let NoOfPaintings = DCount("[Medium]", "[Paintings Table]")
Let A = 0
DoCmd.OpenForm "CatalogueTF", acFormDS
DoCmd.GoToRecord , , acNewRec
DoCmd.OpenForm "CatalogueIndexQF", acFormDS
DoCmd.GoToRecord , , acFirst
For x = 1 To 1000
Let NoOfPersonPainting = DCount("[Medium]", "[Paintings Table]", "[Artist ID No] = Forms!CatalogueIndexQF![Artist ID No]")
Let Forms!CatalogueTF!Surname = Forms!CatalogueIndexQF!Surname
Let Forms!CatalogueTF!Initials = Forms!CatalogueIndexQF!Initials
Let Forms!CatalogueTF!Painting1 = Forms!CatalogueIndexQF![CatalogueNo]
Let A = A + 1
If NoOfPersonPainting = 1 Then GoTo ln2
DoCmd.GoToRecord , , acNext
Let Forms!CatalogueTF!Painting2 = Forms!CatalogueIndexQF![CatalogueNo]
Let A = A + 1
If NoOfPersonPainting = 2 Then GoTo ln2
DoCmd.GoToRecord , , acNext
Let Forms!CatalogueTF!Painting3 = Forms!CatalogueIndexQF![CatalogueNo]
Let A = A + 1
If NoOfPersonPainting = 3 Then GoTo ln2
DoCmd.GoToRecord , , acNext
Let Forms!CatalogueTF!Painting4 = Forms!CatalogueIndexQF![CatalogueNo]
Let A = A + 1
ln2:
If A = NoOfPaintings Then GoTo ln3
DoCmd.OpenForm "CatalogueTF", acFormDS
DoCmd.GoToRecord , , acNewRec
DoCmd.OpenForm "CatalogueIndexQF", acFormDS
DoCmd.GoToRecord , , acNext
Next x
ln3:
DoCmd.Close acForm, "CatalogueIndexQF"
DoCmd.Close acForm, "CatalogueTF"
DoCmd.OpenReport "CatalogueIndex", acViewPreview
End Sub