Access-VBA

宽高拆分成长度

SELECT 分格列表.分格编号, 分格列表.分格名称, 分格列表.分格宽度 as 长度,IIf([分格列表.分格名称]= "横中梃",1,2) AS 数量

FROM 分格列表

WHERE (((分格列表.分格宽度)<>0));

UNION SELECT 分格列表.分格编号, 分格列表.分格名称, 分格列表.分格高度 as 长度,IIf([分格列表.分格名称]= "竖中梃",1,2) AS 数量

FROM 分格列表

WHERE (((分格列表.分格高度)<>0));

Private Sub 添加窗框_Enter()

If Me.Combo0.Value = "" Then

MsgBox "未选系列"

End If

Dim rs As Recordset

Dim sql As String

sql = "select * from 窗型列表 where 窗型列表.系列名称 ='" & Me.Combo0.Value & "'"

Set rs = CurrentDb.OpenRecordset(sql, dbOpenDynaset, dbSeeChanges, dbOptimistic)

If rs.RecordCount = 0 Then

MsgBox "No Recorde"

Else

MsgBox rs.Fields(2)

End If

Set rs = Nothing

End Sub

你可能感兴趣的:(sqlserver)