我有一个跟踪员工质量保证数据的数据库。这是我的查询的screenshot。突出显示的列指示每条记录的QA类型。我想要做的是更改基于此值显示的表单类型(它的查找字段,因此该值实际上是数字)我遇到问题的是从记录集中的下一条记录获取QAType字段的值查询。这是我正在尝试的代码。
Private Sub Command55_Click()
QAType = NextRecord.[QAType].Value
Select Case QAType
Case Is = 1
DoCmd.OpenForm "frmRCRviewClaimEdits"
Case Is = 2
DoCmd.OpenForm "frmRCRviewCredits"
Case Is = 3
DoCmd.OpenForm "frmRCRviewFC"
Case Is = 4
DoCmd.OpenForm "frmRCRviewRegCall"
Case Is = 5
DoCmd.OpenForm "frmRCRviewRegDenials"
Case Is = 6
DoCmd.OpenForm "frmRCRviewRegWQ"
Case Is = 7
DoCmd.OpenForm "frmRCRviewRetro"
Case Is = 8
DoCmd.OpenForm "frmRCRviewRTE"
Case Is = 9
DoCmd.OpenForm "frmRCRviewStateInst"
Case Is = 10
DoCmd.OpenForm "frmRCRviewPC"
Case Else
MsgBox "The Next QA in the Query doesn't have a QA Type!"
End Select
End Sub
我在尝试NextRecord语句时遇到了一个错误,当我把它拉出来时,我有点期待。任何人都可以帮我找到一种方法来实现这个目标吗?
答案 0 :(得分:0)
假设您的表单与查询绑定。
下一条记录:
If CurrentRecord <> RecordsetClone.RecordCount Then DoCmd.GoToRecord , , acNext
以前的记录:
If CurrentRecord <> 1 Then DoCmd.GoToRecord , , acPrevious
答案 1 :(得分:0)
您可以使用以下代码,假设您的字段在记录集中也被命名为QAType
:
Dim rs As Recordset
Set rs = Me.RecordsetClone
rs.Bookmark = Me.Bookmark
If Not rs.EOF Then
rs.MoveNext
QAType = rs!QAType.Value
End If