因此,我对MS Access相对较新,但为我的组织开发了一个相对全面的CRM工具,允许用户记录公司员工,组织详细信息和会议详细信息。
我的编辑组织"我遇到了一个奇怪的问题。形成。当我使用未绑定的查找组合框来更改记录时,它会正确加载新记录;但是,显示在页面底部的记录编号似乎是随机的...例如,如果我使用查找框选择第6条记录,它可能会显示为记录编号96(或其他完全随机的记录)。
我并不十分关心这一点(虽然有点);但是,其他奇怪的行为之一是查找适用于所有记录,除非更改回数据库中的第一个组织。在这种情况下,它不会正确加载EmployeeID和相关信息(但这适用于数据库中的所有其他记录)。
任何建议都会很棒。页面代码如下。我确定目前有一些无关的代码,但没有一个会影响到我的想法...
'Updates the Phone and Email text boxes when the Employee is changed in the dropdown menu
Private Sub cboEmployee_Change()
Me.txtPhone.Value = Me.cboEmployee.Column(2)
Me.txtEmail.Value = Me.cboEmployee.Column(3)
Me.cboRelationship.Value = Null
Me.cboBranch.Requery
Me.cboMinistry.Requery
Me.cboDivision.Requery
End Sub
'Updates the Phone and Email text boxes when the Employee is changed in the dropdown menu
Private Sub cboEmployee_AfterUpdate()
Me.txtPhone.Value = Me.cboEmployee.Column(2)
Me.txtEmail.Value = Me.cboEmployee.Column(3)
Me.cboRelationship.Value = Null
Me.cboBranch.Requery
Me.cboMinistry.Requery
Me.cboDivision.Requery
End Sub
'Requeries the various other boxes on the form after a Ministry is selected and clears the Phone and Email fields. Bit of a hack to use Employee 43 (blank vs. null)
Private Sub cboMinistry_Change()
Me.cboDivision.Value = Null
Me.cboBranch.Value = Null
Me.cboDivision.Requery
Me.cboBranch.Requery
Me.cboEmployee.Requery
Me.txtPhone = Null
Me.txtEmail = Null
End Sub
'Requeries the various other boxes on the form after a Division is selected and clears the Phone and Email fields. Bit of a hack to use Employee 43 (blank vs. null)
Private Sub cboDivision_Change()
Me.cboMinistry.Requery
Me.cboBranch.Requery
Me.cboEmployee.Requery
Me.txtPhone = Null
Me.txtEmail = Null
Me.cboRelationship.Value = Null
End Sub
'Requeries the various other boxes on the form after a Branch is selected and clears the Phone and Email fields. Bit of a hack to use Employee 43 (blank vs. null)
Private Sub cboBranch_Change()
Me.cboDivision.Requery
Me.cboMinistry.Requery
Me.cboEmployee.Requery
Me.txtPhone = Null
Me.txtEmail = Null
Me.cboRelationship.Value = Null
End Sub
'Populates the form with the appropriate details if there is an EmployeeID associated with an organization
Private Sub Form_Current()
Me.cboLookup.Value = Organization
If IsNull(EmployeeID) = True Then
Me.cboMinistry.Value = Null
Me.cboDivision.Value = Null
Me.cboBranch.Value = Null
Me.txtPhone.Value = Null
Me.txtEmail.Value = Null
Else
Me.cboEmployee.Value = EmployeeID
Me.cboBranch.Value = BranchID
Me.cboDivision.Value = DLookup("DivisionID", "tblBranch", "BranchID=" & BranchID)
Me.cboMinistry.Value = DLookup("MinistryID", "tblDivision", "DivisionID=" & Me.cboDivision)
Me.cboEmployee.Requery
Me.cboBranch.Requery
Me.cboDivision.Requery
Me.txtPhone.Value = PhoneNumber
Me.txtEmail.Value = Email
Me.Dirty = False
End If
End Sub