Hello World
I have this code
Code:Public Function Duplicate(ByRef adRecordset As ADODB.Recordset, ByRef Subject As _ String, ByRef Course As String) As Boolean Duplicate = False 'Default value 'Opens and checks the connection SetConnection CheckConnection adRecordset adRecordset.Open "Select SubjectCode From LoadSchedules Where SubjectCode='" & _ Subject & "' And Courses.Title='" & Course & "'", dbConnection, 1, 1 'Checks if there is duplicate subject If adRecordset.RecordCount > 0 Then Duplicate = True Else Duplicate = False End If Set dbConnection = Nothing End FunctionCode:Public Sub Update(ByVal ScheduleID As String, ByRef SubjectCode As String, ByRef _ Lecture As Integer, ByRef Laboratory As Integer, ByRef StartTime As Date, ByRef EndTime _ As Date, ByRef DayID As String, ByRef RoomID As String, adForm As Form) 'Opens and checks the connection SetConnection 'CheckConnection adRecordset 'Update course dbConnection.Execute "Update Schedules Set [SubjectCode]='" & SubjectCode & _ "',[Lecture]=" & Lecture & ",[Laboratory]=" & Laboratory & ",[StartTime]=#" & _ StartTime & "#,[EndTime]=#" & EndTime & "#,[DayID]='" & DayID & "'," & _ "[RoomID]='" & RoomID & "' Where [ScheduleID]='" & ScheduleID & "'" Unload adForm frmSchedules.LoadSchedules MsgBox ScheduleID & " has been successfully updated.", 64, "Updated Schedule" frmSchedules.LoadSchedules Set dbConnection = Nothing Exit Sub
End Sub
I use the duplicate function to check if the subject is already existing before the update function, now my problem is this, I can only update subject if modify it. How can I update the schedule without prompting existing? Hope you understand my post
Rey Sean




Reply With Quote