Hi Again,
This one's driving me crazy,
I am updating 3 fields in my staff table with the following code:
CurrentDb.Execute "UPDATE tblstaffCodes SET Discipline = '" & Forms!FormJobDescriptions!FormStaffLookup!Discipline & "' WHERE PayNumber = '" & Forms!FormJobDescriptions!FormStaffLookup!Text1 & "' and AdditPayNumber =0"
CurrentDb.Execute "UPDATE tblstaffCodes SET Grade = '" & Forms!FormJobDescriptions!FormStaffLookup!Grade & "' WHERE PayNumber = '" & Forms!FormJobDescriptions!FormStaffLookup!Text1 & "' and AdditPayNumber =0"
CurrentDb.Execute "UPDATE tblstaffCodes SET JobDescription = '" & Forms!FormJobDescriptions!FormStaffLookup![Job Title/Description] & "' WHERE PayNumber = '" & Forms!FormJobDescriptions!FormStaffLookup!Text1 & "' and AdditPayNumber =0"
This works fine now (thanks rjoubert) but after this I want to change the "additPayNumber" to whatever record number it is for that staff member by counting their "PayNumber" with the following code:
Dim varx As Variant
varx = DCount("*", "[tblStaffCodes]", "[PayNumber]=" & Forms!FormJobDescriptions!FormStaffLookup!Text1)
CurrentDb.Execute "UPDATE [tblStaffCodes] SET [AdditPayNumber]=" & varx & " WHERE [AdditPayNumber] =0"
The button that fires the code is on a subform "FormStaffLookupSubform" which is on a form "FormStaffLookup" which is selected on a tab control on "FormJobDescriptions" the problem I have is that I am getting an error message saying "You canceled the previous operation" can anyone offer me any advice or help with this.
This one's driving me crazy,
I am updating 3 fields in my staff table with the following code:
CurrentDb.Execute "UPDATE tblstaffCodes SET Discipline = '" & Forms!FormJobDescriptions!FormStaffLookup!Discipline & "' WHERE PayNumber = '" & Forms!FormJobDescriptions!FormStaffLookup!Text1 & "' and AdditPayNumber =0"
CurrentDb.Execute "UPDATE tblstaffCodes SET Grade = '" & Forms!FormJobDescriptions!FormStaffLookup!Grade & "' WHERE PayNumber = '" & Forms!FormJobDescriptions!FormStaffLookup!Text1 & "' and AdditPayNumber =0"
CurrentDb.Execute "UPDATE tblstaffCodes SET JobDescription = '" & Forms!FormJobDescriptions!FormStaffLookup![Job Title/Description] & "' WHERE PayNumber = '" & Forms!FormJobDescriptions!FormStaffLookup!Text1 & "' and AdditPayNumber =0"
This works fine now (thanks rjoubert) but after this I want to change the "additPayNumber" to whatever record number it is for that staff member by counting their "PayNumber" with the following code:
Dim varx As Variant
varx = DCount("*", "[tblStaffCodes]", "[PayNumber]=" & Forms!FormJobDescriptions!FormStaffLookup!Text1)
CurrentDb.Execute "UPDATE [tblStaffCodes] SET [AdditPayNumber]=" & varx & " WHERE [AdditPayNumber] =0"
The button that fires the code is on a subform "FormStaffLookupSubform" which is on a form "FormStaffLookup" which is selected on a tab control on "FormJobDescriptions" the problem I have is that I am getting an error message saying "You canceled the previous operation" can anyone offer me any advice or help with this.