|
3#
楼主 |
发表于 2006-4-12 01:57:00
|
只看该作者
Private Sub Form_Current()
Me![item_no] = Forms![srrtg]![item_no]
Me![item_desc] = Forms![srrtg]![item_desc_1]
Me![rtg_no] = Forms![srrtg]![rtg_no]
Dim rs1 As New ADODB.Recordset
Dim rs2 As New ADODB.Recordset
Dim stemp As String
Dim i As Integer
stemp = "select * from dbo_z_srdtl where item_no='" & Forms![srrtg]![item_no] & "'and rtg_no='" & Forms![srrtg]![rtg_no] & "' "
rs1.Open stemp, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
stemp = "select * from dnc where item_no='" & Forms![srrtg]![item_no] & "'and rtg_no='" & Forms![srrtg]![rtg_no] & "' "
rs2.Open stemp, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
If rs2.RecordCount <> 0 Then
For i = 1 To rs1.RecordCount
If rs1("oper_no") = rs2("oper_no") Then
Me.DNC = rs2("DNC")
Else: Me.DNC = Null
End If
Next i
Else: Me.DNC = Null
End If
Exit Sub
End Sub |
|