Where would I insert the code to see the finished SQL? I apologize for this code. I have looked a videos and examples on the internet so it's a mix of things I have figured out over the last month. The is my one and only attempt at creating a database. Thanks for any help...
Private Sub cmdCAdd_Click()
'add data to table
If Me.txtCID.Tag & "" = "" Then
CurrentDb.Execute "INSERT INTO COURSE (BranchID, Course, CourseDescription, CourseLimitations) " & _
"VALUES (" & Me.cboBranch & ",'" & Me.txtCourse & "', '" & Me.txtCourseDescription & "'," ' & Me.txtCourseLimitations & "') "
Else
CurrentDb.Execute "UPDATE COURSE " & _
" SET CourseID=" & Me.txtCID & _
", Course='" & Me.txtCourse & "'" & _
", CourseDescription='" & Me.txtCourseDescription & "'" & _
", CourseLimitations='" & Me.txtCourseLimitations & "'" & _
"WHERE CourseID=" & Me.txtCID.Tag
End If
cmdCClear_Click
'refresh data in list on form
subCourse.Form.Requery
End Sub
Private Sub cmdCClear_Click()
Me.txtCID = ""
Me.txtCourse = ""
Me.txtCourseDescription = ""
Me.txtCourseLimitations = ""
Me.txtCourse.SetFocus
'set button edit to enable
Me.cmdCUpdate.Enabled = True
'change caption of button add to Add
Me.cmdCAdd.Caption = "Add"
'clear tag on txtID for reset new
Me.txtCID.Tag = ""
End Sub
Private Sub cmdCUpdate_Click()
'check whether there exists data in list
If Not (Me.subCourse.Form.Recordset.EOF And Me.subCourse.Form.Recordset.BOF) Then
'get data to text box control
With Me.subCourse.Form.Recordset
Me.txtCourse = .Fields("Course")
Me.txtCourseDescription = .Fields("CourseDescription")
Me.txtCourseLimitations = .Fields("CourseLimitations")
'store id of course in Tag of txtCID in case id is modified
Me.txtCID.Tag = .Fields("CourseID")
'change caption of button add to Update
Me.cmdCAdd.Caption = "Update"
'disable button edit
Me.cmdCUpdate.Enabled = False
End With
End If