Lrn2Code
Registered User.
- Local time
- Today, 05:30
- Joined
- Dec 8, 2008
- Messages
- 56
Hello,
I searched the site and couldn't seem to find a reference to the issue I'm dealing with. Am having a tough time getting an If Then statement to run properly. Am trying to find if an exact value is in a table and if it is not then the table needs to be updated to that new value. My code is below and it's running whether the item is in the table or not so I know something isn't right.
If strName <> ("tblschoolclasses.coursename") Then
strSQL = "Update tblschoolclasses set coursename = '" & strName & "' where courseid = " & lngID & " and POSID = '" & strPSID & "'"
Debug.Print (strSQL)
Set qdf = dbs.CreateQueryDef("", strSQL)
qdf.Execute
X = 1 (This is to calculate that the item has been updated)
End If
Included above this If Then statement is the following where the current values from the form are set -
Thanks in advance for any guidance you can provide.
I searched the site and couldn't seem to find a reference to the issue I'm dealing with. Am having a tough time getting an If Then statement to run properly. Am trying to find if an exact value is in a table and if it is not then the table needs to be updated to that new value. My code is below and it's running whether the item is in the table or not so I know something isn't right.
If strName <> ("tblschoolclasses.coursename") Then
strSQL = "Update tblschoolclasses set coursename = '" & strName & "' where courseid = " & lngID & " and POSID = '" & strPSID & "'"
Debug.Print (strSQL)
Set qdf = dbs.CreateQueryDef("", strSQL)
qdf.Execute
X = 1 (This is to calculate that the item has been updated)
End If
Included above this If Then statement is the following where the current values from the form are set -
strName = Me.txtName
lngID = Me.txtCourseID
strPSID = Me.txtPOS
strcoursecat = Me.cmbcoursecat
strSQL = "select * from tblschoolclasses where coursename = '" & strName & "' and POSID = '" & strPSID & "'"
In the ("tblschoolclasses.coursename") I'm getting an error 424 - Object Required. What's that all about?lngID = Me.txtCourseID
strPSID = Me.txtPOS
strcoursecat = Me.cmbcoursecat
strSQL = "select * from tblschoolclasses where coursename = '" & strName & "' and POSID = '" & strPSID & "'"
Thanks in advance for any guidance you can provide.