以下是引用片段:
实现功能的关键代码为: Private Sub Form_Activate() If Me.Tag = "tmp" Then Me.Tag = "" Exit Sub End If
'根据传递的标志 查询并显示住房内容 Dim tmprs As New ADODB.Recordset Dim hzrs As New ADODB.Recordset Set tmprs = ExecSql("select * from zfxx, jmqxx, sqxx where zfxx.sssq=sqxx.sqdm and zfxx.ssjmq=jmqxx.jmqdm and zfdm='" & Me.txtID.Text & "'") With tmprs If .RecordCount > 0 Then If Trim(.Fields("sshz").Value) <> "" Then Set hzrs = ExecSql("select * from hzxx where hzdm = '" + Trim(.Fields("sshz").Value) + "'") Me.txtsshz.Text = hzrs.Fields("hzxm").Value Me.txtsshz.Tag = .Fields("sshz").Value End If Me.txtssjmq.Text = .Fields("jmqmc").Value Me.txtssjmq.Tag = .Fields("ssjmq").Value Me.txtsssq.Text = .Fields("sqmc").Value Me.txtsssq.Tag = .Fields("sssq").Value Me.txtjzmj.Text = .Fields("zfjzmj").Value Me.Chkifcs.Value = .Fields("ifxs").Value Me.txtcsjg.Text = .Fields("xsjg").Value If IsNull(.Fields("sjxsjg").Value) = False Then Me.txtsjcsjg.Text = .Fields("sjxsjg").Value End If Me.txtbz.Text = .Fields("bz").Value Me.DTPickerjcsj.Value = .Fields("jcsj").Value Me.Combocx.ListIndex = GetComboIndex(Me.Combocx, Trim(.Fields("cx").Value)) Me.Combohx.ListIndex = GetComboIndex(Me.Combohx, Trim(.Fields("hx").Value)) Me.Combofcxz.ListIndex = GetComboIndex(Me.Combofcxz, Trim(.Fields("fcxz").Value)) End If End With
If Me.MMButton_XPBEcs.Visible = False Then MMButton_XPGE2.Enabled = False txtsjcsjg.Enabled = False End If
If Me.MMButton_XPBEcs.Visible = False And Me.MMButton_XPBEts.Visible = False Then MMButton_XPGE2.Enabled = False txtsjcsjg.Enabled = False txtbz.Enabled = False End If End Sub Private Sub MMButton_XPBEcs_Click() Dim strresult As String
'修改住房出售信息 If Me.txtsshz.Text = "" Then MsgBox "所属户主不能为空" Exit Sub End If strresult = Exec_SqL("update zfxx set sshz='" & Trim(Me.txtsshz.Tag) & "'," _ & " sjxsjg =" & Val(Me.txtsjcsjg.Text) & ", " _ & " bz ='" & Me.txtbz.Text & "' where " _ & " zfdm ='" & Trim(Me.txtID.Text) & "'") If strresult <> "OK" Then MsgBox strresult Exit Sub End If log = InsertOperateLog("住房出售", "成功") Call frmZFXS.UpdateList(" ")
Unload Me End Sub
Private Sub MMButton_XPBEts_Click() Dim strresult As String
'修改住房退售信息 If Me.txtsshz.Text = "" Then MsgBox "所属户主不能为空" Exit Sub End If strresult = Exec_SqL("update zfxx set sshz='" & "" & "'," _ & " sjxsjg =" & 0 & ", " _ & " bz ='" & Me.txtbz.Text & "' where " _ & " zfdm ='" & Trim(Me.txtID.Text) & "'") If strresult <> "OK" Then MsgBox strresult Exit Sub End If log = InsertOperateLog("住房退售", "成功") Call frmZFXS.UpdateList(" ")
Unload Me End Sub
|