Rss & SiteMap

Foxtable(狐表) http://www.foxtable.com

新一代数据库软件,完美融合Access、Foxpro、Excel、vb.net之优势,人人都能掌握的快速软件开发工具!
共3 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:代码不执行,高手请进

1楼
yanzhen2010 发表于:2011/8/1 10:13:00

With Tables("长期医嘱")
    .Position = .Rows.Count - 1
End With
If e.form.Controls("ComboBox1").Value Is Nothing Or e.form.Controls("ComboBox4").Value Is Nothing Then
    MsgBox("请选择患者住院号和追加类别!",64,"提示")
If Tables("长期医嘱").Rows.count >0 Then
Dim cm4 As WinForm.ComboBox = e.Form.Controls("ComboBox4")
    Dim f As New Filler
    f.SourceTable = DataTables("追加项目")
    f.SourceCols = "拼音码,项目名称"
    f.DataTable = DataTables("长期医嘱")
    f.DataCols = "拼音码,项目名称"
    f.Filter = "分组名称 ='" & cm4.Value & "'"
    f.Fill()
Dim Nu ,X ,Rq,Ys As String
Nu =CurrentTable.Current("编号")
X = e.Form.Controls("ComboBox1").value
Rq= e.Form.Controls("DateTimePicker1").value
Ys=e.Form.Controls("ComboBox5").value
Dim drs As List(Of DataRow)
drs = DataTables("长期医嘱").Select("[编号] >'" & Nu &"'")
For Each dr As DataRow In drs
    dr("住院号") = X
    dr("开嘱日期") = Rq
    dr("医生") = Ys
Next
With Tables("长期医嘱")
    .Position = .Rows.Count - 1
End With
Else
Dim cm4 As WinForm.ComboBox = e.Form.Controls("ComboBox4")
    Dim f As New Filler
    f.SourceTable = DataTables("追加项目")
    f.SourceCols = "拼音码,项目名称"
    f.DataTable = DataTables("长期医嘱")
    f.DataCols = "拼音码,项目名称"
    f.Filter = "分组名称 ='" & cm4.Value & "'"
    f.Fill()
Dim Nu ,X ,Rq,Ys As String
Nu =CurrentTable.Current("编号")
X = e.Form.Controls("ComboBox1").value
Rq= e.Form.Controls("DateTimePicker1").value
Ys=e.Form.Controls("ComboBox5").value
Dim drs As List(Of DataRow)
drs = DataTables("长期医嘱").Select("[编号] ='" & Nu &"'")
For Each dr As DataRow In drs
    dr("住院号") = X
    dr("开嘱日期") = Rq
    dr("医生") = Ys
Next
With Tables("长期医嘱")
    .Position = .Rows.Count - 1
End With
End If
End If

 

问题可能出在If语句上。

我的意思:

第一步:返回最末行

第二步:如果表中为空行,执行第二个IF

否则执行else

[此贴子已经被作者于2011-8-1 10:32:28编辑过]
2楼
狐狸爸爸 发表于:2011/8/1 10:24:00
If e.form.Controls("ComboBox1").Value Is Nothing Or e.form.Controls("ComboBox4").Value Is Nothing Then
    MsgBox("请选择患者住院号和追加类别!",64,"提示")
    Return
End If
With Tables("长期医嘱")
    .Position = .Rows.Count - 1
End With
If Tables("长期医嘱").Rows.count >0 Then
    Dim cm4 As WinForm.ComboBox = e.Form.Controls("ComboBox4")
    Dim f As New Filler
    f.SourceTable = DataTables("追加项目")
    f.SourceCols = "拼音码,项目名称"
    f.DataTable = DataTables("长期医嘱")
    f.DataCols = "拼音码,项目名称"
    f.Filter = "分组名称 ='" & cm4.Value & "'"
    f.Fill()
    Dim Nu ,X ,Rq,Ys As String
    Nu =CurrentTable.Current("编号")
    X = e.Form.Controls("ComboBox1").value
    Rq= e.Form.Controls("DateTimePicker1").value
    Ys=e.Form.Controls("ComboBox5").value
    Dim drs As List(Of DataRow)
    drs = DataTables("长期医嘱").Select("[编号] >'" & Nu &"'")
    For Each dr As DataRow In drs
        dr("住院号") = X
        dr("开嘱日期") = Rq
        dr("医生") = Ys
    Next
    With Tables("长期医嘱")
        .Position = .Rows.Count - 1
    End With
Else
    Dim cm4 As WinForm.ComboBox = e.Form.Controls("ComboBox4")
    Dim f As New Filler
    f.SourceTable = DataTables("追加项目")
    f.SourceCols = "拼音码,项目名称"
    f.DataTable = DataTables("长期医嘱")
    f.DataCols = "拼音码,项目名称"
    f.Filter = "分组名称 ='" & cm4.Value & "'"
    f.Fill()
    Dim Nu ,X ,Rq,Ys As String
    Nu =CurrentTable.Current("编号")
    X = e.Form.Controls("ComboBox1").value
    Rq= e.Form.Controls("DateTimePicker1").value
    Ys=e.Form.Controls("ComboBox5").value
    Dim drs As List(Of DataRow)
    drs = DataTables("长期医嘱").Select("[编号] ='" & Nu &"'")
    For Each dr As DataRow In drs
        dr("住院号") = X
        dr("开嘱日期") = Rq
        dr("医生") = Ys
    Next
    With Tables("长期医嘱")
        .Position = .Rows.Count - 1
    End With
End If
3楼
yanzhen2010 发表于:2011/8/1 15:59:00

谢谢老总百忙之中给予无私帮助。我也在加紧学习。系统做成后立即注册,将现在使用的易表版升级为狐表版。

有各位鼎力帮助,改版大有希望。

共3 条记录, 每页显示 10 条, 页签: [1]

Copyright © 2000 - 2018 foxtable.com Tel: 4000-810-820 粤ICP备11091905号

Powered By Dvbbs Version 8.3.0
Processed in .02539 s, 2 queries.