I have a form that i want to be able to reassign a specific piece of software to a different machine.
Form specs:
Software Title: cbotitle
CDKEY: cbocdkey
Old Assignment: cbooldassignmen t
New Assignment: cbonewassignmen t
I've built a query that pulls a list of all the computers the software is currently assigned to dynamically by gettings its criteria from the current form.
If i open the query manually after completing the form everythign works fine.
SQL for qryASSIGNCHANGE :
Then on my submit button I want to find the first value in the query that matches the cbooldassignmen t and change it to the new. I used findfirst because there could be more than one UNASSIGNED for example and i dont want it to change all of them to the new value.
Code for Submit Button:
I Keep getting Error 3061: Too few parameters. Expected 1
I have tried all kinds of things even specifying the parameter with querydefs but couldnt get that to work either. Does anyone know what my problem could be and what I might need to do differently?
Form specs:
Software Title: cbotitle
CDKEY: cbocdkey
Old Assignment: cbooldassignmen t
New Assignment: cbonewassignmen t
I've built a query that pulls a list of all the computers the software is currently assigned to dynamically by gettings its criteria from the current form.
If i open the query manually after completing the form everythign works fine.
SQL for qryASSIGNCHANGE :
Code:
SELECT tblSOFTWARE.COMPUTER FROM tblSOFTWARE WHERE (((tblSOFTWARE.KEY)=[forms]![frmASSIGNSOFTWARE].[cbocdkey].[value]));
Code for Submit Button:
Code:
Private Sub Command8_Click()
Dim db As DAO.Database
Dim rcd As DAO.Recordset
Dim newassignment As String
Dim oldassignment As String
newassignment = Me.cbonewassignment.Value
oldassignment = Me.cbooldassignment.Value
Set db = CurrentDb
Set rcd = db.OpenRecordset("qryASSIGNCHANGE")
rcd.FindFirst ([COMPUTER] = oldassignment)
rcd.Edit
rcd![COMPUTER] = newassignment
rcd.Update
rcd.Close
cbotitle.Value = Null
cbocdkey.Value = Null
cbooldassignment.Value = Null
cbonewassignment.Value = Null
End Sub
I have tried all kinds of things even specifying the parameter with querydefs but couldnt get that to work either. Does anyone know what my problem could be and what I might need to do differently?
Comment