最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

抽獎程序 Access數(shù)據(jù)庫功能模塊講解 VBA代碼編程實例

2022-05-01 16:24 作者:凌霄百科  | 我要投稿

Public a1 As Integer

Public idnum As Long

Dim rs1 As DAO.Recordset? ? '定義記錄集變量

Private Sub Command抽獎1_Click()

If a1 = 1 Then

a1 = 0

rs1.Close

Else

a1 = 1

Set rs1 = CurrentDb.OpenRecordset("獎勵表", dbOpenTable)

End If

End Sub


Private Sub Command抽獎2_Click()

If a1 = 1 Then

a1 = 0

rs1.Close

DoCmd.SetWarnings (False)

Dim del_sql As String

del_sql = "Delete From 獎勵表 Where ID=" & idnum

DoCmd.RunSQL del_sql

Else

a1 = 1

Set rs1 = CurrentDb.OpenRecordset("獎勵表", dbOpenTable)

End If

End Sub


Private Sub Command重置_Click()

DoCmd.SetWarnings (False)

Dim del_sql As String

del_sql = "Delete From 獎勵表"

DoCmd.RunSQL del_sql

Dim update_sql As String

update_sql = "insert into 獎勵表 select * From 獎勵備份表"

DoCmd.RunSQL update_sql

End Sub


Sub 抽獎1()

On Error GoTo 抽獎完成

If a1 = 1 Then

Dim Record_count As Long

? ? Record_count = rs1.RecordCount

? ? Dim rnd_i As Long

? ? '--------------------------------------------------------

? ? Randomize

? ? rnd_i = Int((Record_count - 1 + 1) * Rnd + 1)

? ? rs1.MoveFirst

? ? rs1.Move (rnd_i - 1)

? ? Me.獎勵 = rs1.Fields("獎勵名稱").Value

? ? idnum = rs1.Fields("ID").Value

End If

Exit Sub

抽獎完成:

MsgBox "抽獎完成,重新抽獎可重置"

a1 = 0

rs1.Close

End Sub




Private Sub Form_Timer()

If a1 = 1 Then


? ? Call 抽獎1


End If

End Sub


抽獎程序 Access數(shù)據(jù)庫功能模塊講解 VBA代碼編程實例的評論 (共 條)

分享到微博請遵守國家法律
祁阳县| 从江县| 扶风县| 白山市| 佳木斯市| 疏勒县| 教育| 绥芬河市| 甘孜| 贵阳市| 钟祥市| 珲春市| 灵宝市| 鄂托克旗| 湘潭县| 灌云县| 肥西县| 宁陵县| 平乡县| 房产| 盘山县| 鸡西市| 绥棱县| 阳信县| 吉木乃县| 三原县| 塔河县| 滁州市| 正镶白旗| 北川| 柯坪县| 玉门市| 繁昌县| 航空| 恭城| 抚州市| 武川县| 宁强县| 宁河县| 璧山县| 渭南市|