|
我想问下插入后,光标老是跑到第一条记录,请问在下面的代码中哪里添加一段代码使它
定位在当前记录?
Private Sub TJJL1_Click()
On Error GoTo Err_TJJL1_Click
Dim cur_zid, las_zid, pointer
cur_zid = Me.ZID.Value
DoCmd.OpenForm "ZHUKU_DATA", acNormal
DoCmd.GoToRecord acDataForm, "ZHUKU_DATA", acLast
las_zid = Form_ZHUKU_DATA.CurrentRecord
For pointer = las_zid To cur_zid Step -1
Form_ZHUKU_DATA.ZID.Value = Form_ZHUKU_DATA.CurrentRecord + 1
If pointer > cur_zid Then
DoCmd.GoToRecord , , acPrevious
End If
Next pointer
DoCmd.GoToRecord acDataForm, "ZHUKU_DATA", acNewRec
Form_ZHUKU_DATA.ZID.Value = cur_zid '将新增记录的 ZID 改为插入位置的记录号
Form_ZHUKU_DATA.DANO.Value = "*"
DoCmd.Close acForm, "ZHUKU_DATA", acSaveYes
Me.Requery
Me.NO.SetFocus
DoCmd.Save
Exit_TJJL1_Click:
Exit Sub
Err_TJJL1_Click:
MsgBox Err.Description
Resume Exit_TJJL1_Click
End Sub
另:如果打印查询结果?代码怎么写? |
|