# FindFirst的问题....对各位来说一定是个小问题....Help...help...!!

Posted by lulu on August 26, 1999 at 16:11:39:

请问FindFirst可以做数字的搜寻比对吗?
我写了段程式如下：是想将资料表中符合Y,M,D三个数值的资料的合约编号加入Combo1中,但却出现”型态不符合”,能否指导一下,是错在哪哩!!我实在是不知哪出了错误!!

Private Sub Command1_Click()
Dim todayyear,todaymonth,todayday, Y, M, D as Integer
todayyear = Year(Now) - 1911
todaymonth = Month(Now)
todayday = Day(Now)
Select Case todaymonth
Case 1, 3, 5, 7, 8, 10
If todayday > 18 Then
D = todayday - 18
M = todaymonth + 1
Y = todayyear
Else
D = todayday + 13
M = todaymonth
Y = todayyear
End If
Case 4, 6, 9, 11
If todayday > 17 Then
D = todayday - 17
M = todaymonth + 1
Y = todayyear
Else
D = todayday + 13
M = todaymonth
Y = todayyear
End If
Case 2
If todayday > 15 Then
D = todayday - 15
M = todaymonth + 1
Y = todayyear
Else
D = todayday + 13
M = todaymonth
Y = todayyear
End If
Case 12
If todayday > 18 Then
D = todayday - 18
M = todaymonth + 1
M = M Mod 12
Y = todayyear + 1
Else
D = todayday + 13
M = todaymonth
Y = todayyear
End If
End Select
Data1.Recordset.FindFirst "[结束月]"=Y and "[结束月]"=M and
"[结束日]"=D
Do While Not Data1.Recordset.EOF
Combo1.AddItem Data1.Recordset.Fields("合约编号")
Data1.Recordset.MoveNext
Loop
End Sub

Follow Ups:

- Re: FindFirst的问题....对各位来说一定是个小问题....Help...help...!! 小琳 22:02:34 8/26/99 (3)
  - FindFirst的问题....再问一下....Help...help...!! LuLu 08:11:01 8/27/99 (0)
  - Re: FindFirst的问题....对各位来说一定是个小问题....Help...help...!! LuLu 07:52:03 8/27/99 (1)
    - Re: FindFirst的问题....对各位来说一定是个小问题....Help...help...!! 小琳 20:33:32 8/27/99 (0)