I have a form with
CategoryID - frn key
ProductID - frn key
DateAcquired - enter date
StatusID - frn key
TxtN - unbound text box
create - button
openform - button
The idea is to fill out all those fields and on clicking create, txtN (unbound txtbox) amount of records with identical catid, prodid, date aq and statid appear in the itemtbl.
On clicking a second button - openform (this will eventually be on the same button... one step at a time) "MultipleItemAddDetails" should open, I want it to ONLY show the last txtN amount of records created... i have set up qry ststupid which sorts the itemtbl by itemid desc. so if i could only tell it to open up with txtN from the TOP and have it work!!!
I have included my code below. Thanks!
I get runtime error 3075 Syntax error missing operator in query expression 'TOP4* '
Cheers,
Lou
CategoryID - frn key
ProductID - frn key
DateAcquired - enter date
StatusID - frn key
TxtN - unbound text box
create - button
openform - button
The idea is to fill out all those fields and on clicking create, txtN (unbound txtbox) amount of records with identical catid, prodid, date aq and statid appear in the itemtbl.
On clicking a second button - openform (this will eventually be on the same button... one step at a time) "MultipleItemAddDetails" should open, I want it to ONLY show the last txtN amount of records created... i have set up qry ststupid which sorts the itemtbl by itemid desc. so if i could only tell it to open up with txtN from the TOP and have it work!!!
I have included my code below. Thanks!
I get runtime error 3075 Syntax error missing operator in query expression 'TOP4* '
Code:
'Button to open form
Private Sub Openform_Click()
Dim strSQL As String
strSQL = [COLOR=darkred][B]"SELECT TOP " & Me.TxtN & " " & " itemid FROM ststupid"[/B][/COLOR]
DoCmd.openform "multipleitemadddetails", , , , , , strSQL
End Sub
'on open event of multipleitemadddetails
Private Sub Form_Open(Cancel As Integer)
Me.RecordSource = Me.OpenArgs
End Sub
'sql of qry ststupid
SELECT itemtbltest.ItemID, itemtbltest.CategoryID, itemtbltest.ProductID,
itemtbltest.Serial_Number, itemtbltest.Date_Aquired, itemtbltest.StatusID,
itemtbltest.AssetNo, itemtbltest.IMEI, itemtbltest.SIMCardNo,
itemtbltest.SIMPhNo, itemtbltest.PlanID, itemtbltest.PIN, itemtbltest.PUK,
itemtbltest.Comments
FROM itemtbltest
ORDER BY itemtbltest.ItemID DESC;
Cheers,
Lou