silentwolf
Active member
- Local time
- Today, 06:49
- Joined
- Jun 12, 2009
- Messages
- 545
Hi guys,
In my main form I have a few subforms. On one subform I have a button to open another form to search for ITEMS.
All works not a problem.
However what I would like to achive is to insert the ID from the Subform and the ID from the Searchform after selecting a ITEM into a table.
here is what I have so far:
I do gen an Error Amount of Parameters do not match Runtime Error "3061"
But I can not spot it why I get this error?
the tbl_ArtikelModell has an ID .. AutoNumber and those two Fields as mentioned above.
Also I am not sure how to have a Error Handler to that code as I have set up an INDIZIS to that table so there are no dublicates allowed.
Would be nice if someone can give me a little hint here.
Many Thanks
Albert
In my main form I have a few subforms. On one subform I have a button to open another form to search for ITEMS.
All works not a problem.
However what I would like to achive is to insert the ID from the Subform and the ID from the Searchform after selecting a ITEM into a table.
here is what I have so far:
Code:
Private Sub btnOK_Click()
Dim lngArtID As Long
lngArtID = Me.Form.Art_ID
Dim lngModID As Long
lngModID = Forms![frm_Auftraege]![sfm_AuftragModelle].Form![AufM_ID]
Call InsertInto(lngArtID, lngModID)
End Sub
Code:
Sub InsertInto(lngModID As Long, lngArtID As Long)
Dim dbs As Database
Set dbs = CurrentDb
dbs.Execute " INSERT INTO tbl_ArtikelModell " _
& "(ArtM_Art_IDRef,ArtM_Mod_IDRef) VALUES " _
& "(lngArtID, lngModID);"
dbs.Close
End Sub
I do gen an Error Amount of Parameters do not match Runtime Error "3061"
But I can not spot it why I get this error?
the tbl_ArtikelModell has an ID .. AutoNumber and those two Fields as mentioned above.
Also I am not sure how to have a Error Handler to that code as I have set up an INDIZIS to that table so there are no dublicates allowed.
Would be nice if someone can give me a little hint here.
Many Thanks
Albert