VFP选项按钮组赋值问题
我做个一个表单,功能是:查询。表单的数据环境有2个表,有那个选项按钮组optiongroup1和optiongroup2,有一个text,一个查询的命令按钮,一个表格,我想实现我点击两个选项按钮组中的任意一个按钮,再在对应的text中输入部分字段,再点击查询,就能将含有该字段的信息全部显示在表格中,这样该怎么实现呢?请各位帮忙,在此先谢谢了
[解决办法]
请参考:
If !Empty(Thisform.text1.Value)
Thisform.grid1.RecordSource=Null
Thisform.grid1.ColumnCount=-1
If Thisform.optiongroup1.Value=1
Select * Into Cursor t1 From 表1 Where 字段名=Thisform.text1.Value&& 查询表1
Else
Select * Into Cursor t1 From 表2 Where 字段名=Thisform.text1.Value&& 查询表2
Endif
Thisform.grid1.RecordSource='t1'
Thisform.grid1.Refresh
Endif
[解决办法]
If !Empty(Thisform.text1.Value)
Thisform.grid1.RecordSource=Null
Thisform.grid1.ColumnCount=-1
If Thisform.optiongroup1.Value=1
Select * Into Cursor t1 From 表1 Where 字段名=Thisform.text1.Value&& 查询表1 如果字段名为字符型,条件'='前后要加ALLTRIM()Else
Select * Into Cursor t1 From 表2 Where 字段名=Thisform.text1.Value&& 查询表2 如果字段名为字符型,条件'='前后要加ALLTRIM()Endif
Thisform.grid1.RecordSource='t1'
Thisform.grid1.Refresh
Endif