我有一张excel表,其中包含学生将填写的用户表单,以便填充我的数据库。我将输入打印到公共文件(Master)中,然后根据输入打印到其他文件中。鉴于内容的私密性,我密码保护我的数据库(所以只有我可以访问所有这些)。但是,学生有时需要更新他们的输入,然后我遇到了2个问题。
1)如果我为每个学生手动更新我的主表,则其他任何表都不会更新。 2)我希望学生在没有访问数据库的情况下更新他们自己的条目,因为对我来说执行所有更新会很繁琐。我正在考虑制作另一个表格来更新数据库,但我不确定如何实现它。
有关如何尝试实施解决方案的任何提示?
以下是我的代码示例:
studentName.Value=""
studentID.Value=""
With status
.AddItem "Full Time"
.AddItem "Part Time"
End With
Private Sub cmdSubmit_Click()
Dim irow As Long
Dim ws As Worksheet
Set ws = Worksheets("Master")
'find first empty row in database
irow = ws.Cells.Find(What:="*", SearchOrder:=xlRows, _
SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1
'Populate Master
With ws
.Cells(irow, 1).Value = Me.studentName.Value
.Cells(irow, 2).Value = Me.studentID.Value
.Cells(irow, 3).Value = Me.status.Value
End With
'if the student is full time print his info into the full time sheet
If Me.status.Value = "Full Time" Then
Dim ws1 As Worksheet
Set ws1 = Worksheets("Full Time")
'find first empty row in database
irow = ws1.Cells.Find(What:="*", SearchOrder:=xlRows, _
SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1
'Populate Full Time
With ws1
.Cells(irow, 1).Value = Me.studentName.Value
.Cells(irow, 2).Value = Me.studentID.Value
End ws1