Home Database Mysql Tutorial Access设计抽奖系统

Access设计抽奖系统

Jun 07, 2016 pm 04:23 PM
access lottery system design

一、系统组成及原理 抽奖系统主要由来宾登记、奖票管理、幸运抽奖、获奖查询四个基本模块构成,登记模块登记参加抽奖人员,奖票管理模块初始化参加抽奖人员名单,抽奖模块实现抽奖功能,获奖查询模块查询获奖结果。其中,抽奖模块中可以实现奖励等级、总抽奖

   一、系统组成及原理

  抽奖系统主要由来宾登记、奖票管理、幸运抽奖、获奖查询四个基本模块构成,登记模块登记参加抽奖人员,奖票管理模块初始化参加抽奖人员名单,抽奖模块实现抽奖功能,获奖查询模块查询获奖结果。其中,抽奖模块中可以实现奖励等级、总抽奖数、每一次抽奖数的控制。系统架构框图如图1。

Access设计抽奖系统 三联

  图1 系统架构

  二、系统初始化

  来宾登记模块中已经收录了参加抽奖的人员名单以及所属部门,在奖票管理模块中,,当点击初始化按钮时通过内部程序设计首先把上次的抽奖结果清空,同时利用Rnd在参加抽奖的人员名单前随机生成一系列的序号,为幸运抽奖模块中的随机抽奖做准备[1]。主要初始化程序代码如下:

  以下为引用的内容:

  DoCmd.SetWarnings False

  DoCmd.OpenQuery "删除对奖票号", acNormal, acEdit

  DoCmd.OpenQuery "追加对奖票号", acNormal, acEdit

  DoCmd.SetWarnings True

  Set qrs = CurrentDb.OpenRecordset("对奖票号")

  qrs.MoveFirst

  i = 1

  Do While Not qrs.EOF

  qrs.Edit

  qrs!序号 = Int((211 - 1) * Rnd)

  qrs!对奖号码 = i

  qrs.Update

  i = i + 1

  qrs.MoveNext

  Loop

  MsgBox ("对奖名单初始化完毕。")

  qrs.Close

  抽奖功能的实现

  通过抽奖模块实现最终抽奖功能。

  通过奖励等级组合框控制抽奖等级,通过抽奖数量组合框控制每批次抽奖数量,通过总抽奖数组合框控制总抽奖数。当奖励等级分别为一、二、三等奖时,抽奖数量和总抽奖数默认值分别为5、10、10和10、30、50。各组合框的具体数值也可以通过上下箭头控制。抽奖界面如图2。

Access设计抽奖系统

  图 2 抽 奖 界 面

  其程序设计比较简单,主要程序如下:

  以下为引用的内容:

  ……

  If Me!奖励等级.Value = 1 Then

  Me!总数量.Value = 10

  End If

  If Me!奖励等级.Value = 2 Then

  Me!总数量.Value = 30

  End If

  If Me!奖励等级.Value = 3 Then

  Me!总数量.Value = 50

  End If

  Forms!抽奖.Q_抽奖统计.Requery

  If Me!奖励等级.Value = 1 Then

  Me!抽奖数量.Value = 5

  End If

  If Me!奖励等级.Value = 2 Or Me!奖励等级.Value = 3 Then

  Me!抽奖数量.Value = 10

  End If

  ……

  通过点击开始按钮开始抽奖,同时按钮标题变为停止,再次点击停止此批次抽奖,同时按钮标题变为开始,继续点击开始下一批次抽奖,如此反复,直至完成总抽奖数,此时提示“抽奖总数已到”,如果未完成总抽奖数就开始另外一轮抽奖,则提示“抽奖限制”。

  内部抽奖主要解决随机性和相对均衡两个问题。系统初始化在参加抽奖人员名单前随机生成了序号,通过查询“号码重排序”将参加抽奖人员名单按照序号升序排列,抽奖时按照序号顺序抽奖,实现了随机的要求。相对均衡要求大致按照各个部门人数占总人数的百分比来分配中奖人数,本系统采用各个部门占总人数的百分比乘以抽奖总数的方法来大致确定各个部门的中奖人数,有小数的数字通过程序设计进行四舍五入处理。需要注意的是,若使所有的部门中奖人数都要用四舍五入的方法进行处理则可能出现错误,为了避免这种情况需要选定一个部门,使其中奖人数等于总抽奖数减去其他各个部门中奖人数之和[2]。抽奖模块的主要程序代码如下:

  以下为引用的内容:

  N = 0

  cnt = Me!电科.Value + Me!电气.Value + Me!自动化.Value + Me!通信.Value + Me!院办.Value + Me!退休.Value

  Do While Me!抽奖数量.Value > N And Not qrs.EOF And cnt

  '电科抽奖

  ’四舍五入确定电科中奖数

  If Me!电科.Value

  If qrs.单位 = "电科" And qrs!批次.Value = 0 Then

  Me!电科.Value = Me!电科.Value + 1

  qrs.Edit

  qrs!奖励等级.Value = Me!奖励等级.Value

  qrs!批次.Value = Me!批次.Value

  qrs.Update

  N = N + 1

  End If

  Else

  End If

  ……

  '退休抽奖

  cnt = Me!电科.Value + Me!电气.Value + Me!自动化.Value + Me!通信.Value + Me!院办.Value + Me!退休.Value

  cnt2= Me!电科.Value + Me!电气.Value + Me!自动化.Value + Me!通信.Value + Me!院办.Value

  '剩余数量分配给退休

  If Me!退休.Value

  If qrs22.单位 = "退休" And qrs!批次.Value = 0 Then

  Me!退休.Value = Me!退休.Value + 1

  qrs.Edit

  qrs22!奖励等级.Value = Me!奖励等级.Value

  qrs22!批次.Value = Me!批次.Value

  qrs22.Update

  N = N + 1

  End If

  Else

  End If

  ……

  ’判断是否完成抽奖

  cnt = Me!电科.Value + Me!电气.Value + Me!自动化.Value + Me!通信.Value + Me!院办.Value + Me!退休.Value

  If cnt = Me!总数量.Value Then

  MsgBox ("抽奖总数已到。")

  Me.可抽奖.Value = 0

  Else

  MsgBox ("抽奖限制。")

  End If

  ……

  结论

  本系统利用ACCESS数据库,结合其内置VBA语言,探讨了系统初始化、抽奖的随机性和相对均衡性等关键问题,满足了抽奖的要求。进行适当调整,该系统可以应用于多种抽奖场合。

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to disable background applications in Windows 11_Windows 11 tutorial to disable background applications How to disable background applications in Windows 11_Windows 11 tutorial to disable background applications May 07, 2024 pm 04:20 PM

1. Open settings in Windows 11. You can use Win+I shortcut or any other method. 2. Go to the Apps section and click Apps & Features. 3. Find the application you want to prevent from running in the background. Click the three-dot button and select Advanced Options. 4. Find the [Background Application Permissions] section and select the desired value. By default, Windows 11 sets power optimization mode. It allows Windows to manage how applications work in the background. For example, once you enable battery saver mode to preserve battery, the system will automatically close all apps. 5. Select [Never] to prevent the application from running in the background. Please note that if you notice that the program is not sending you notifications, failing to update data, etc., you can

Huawei's Qiankun ADS3.0 intelligent driving system will be launched in August and will be launched on Xiangjie S9 for the first time Huawei's Qiankun ADS3.0 intelligent driving system will be launched in August and will be launched on Xiangjie S9 for the first time Jul 30, 2024 pm 02:17 PM

On July 29, at the roll-off ceremony of AITO Wenjie's 400,000th new car, Yu Chengdong, Huawei's Managing Director, Chairman of Terminal BG, and Chairman of Smart Car Solutions BU, attended and delivered a speech and announced that Wenjie series models will be launched this year In August, Huawei Qiankun ADS 3.0 version was launched, and it is planned to successively push upgrades from August to September. The Xiangjie S9, which will be released on August 6, will debut Huawei’s ADS3.0 intelligent driving system. With the assistance of lidar, Huawei Qiankun ADS3.0 version will greatly improve its intelligent driving capabilities, have end-to-end integrated capabilities, and adopt a new end-to-end architecture of GOD (general obstacle identification)/PDP (predictive decision-making and control) , providing the NCA function of smart driving from parking space to parking space, and upgrading CAS3.0

How to convert deepseek pdf How to convert deepseek pdf Feb 19, 2025 pm 05:24 PM

DeepSeek cannot convert files directly to PDF. Depending on the file type, you can use different methods: Common documents (Word, Excel, PowerPoint): Use Microsoft Office, LibreOffice and other software to export as PDF. Image: Save as PDF using image viewer or image processing software. Web pages: Use the browser's "Print into PDF" function or the dedicated web page to PDF tool. Uncommon formats: Find the right converter and convert it to PDF. It is crucial to choose the right tools and develop a plan based on the actual situation.

Honor Magic V3 debuts AI defocus eye protection technology: effectively alleviates the development of myopia Honor Magic V3 debuts AI defocus eye protection technology: effectively alleviates the development of myopia Jul 18, 2024 am 09:27 AM

According to news on July 12, the Honor Magic V3 series was officially released today, equipped with the new Honor Vision Soothing Oasis eye protection screen. While the screen itself has high specifications and high quality, it also pioneered the introduction of AI active eye protection technology. It is reported that the traditional way to alleviate myopia is "myopia glasses". The power of myopia glasses is evenly distributed to ensure that the central area of ​​​​sight is imaged on the retina, but the peripheral area is imaged behind the retina. The retina senses that the image is behind, promoting the eye axis direction. grow later, thereby deepening the degree. At present, one of the main ways to alleviate the development of myopia is the "defocus lens". The central area has a normal power, and the peripheral area is adjusted through optical design partitions, so that the image in the peripheral area falls in front of the retina.

Always new! Huawei Mate60 series upgrades to HarmonyOS 4.2: AI cloud enhancement, Xiaoyi Dialect is so easy to use Always new! Huawei Mate60 series upgrades to HarmonyOS 4.2: AI cloud enhancement, Xiaoyi Dialect is so easy to use Jun 02, 2024 pm 02:58 PM

On April 11, Huawei officially announced the HarmonyOS 4.2 100-machine upgrade plan for the first time. This time, more than 180 devices will participate in the upgrade, covering mobile phones, tablets, watches, headphones, smart screens and other devices. In the past month, with the steady progress of the HarmonyOS4.2 100-machine upgrade plan, many popular models including Huawei Pocket2, Huawei MateX5 series, nova12 series, Huawei Pura series, etc. have also started to upgrade and adapt, which means that there will be More Huawei model users can enjoy the common and often new experience brought by HarmonyOS. Judging from user feedback, the experience of Huawei Mate60 series models has improved in all aspects after upgrading HarmonyOS4.2. Especially Huawei M

How does the Java reflection mechanism modify the behavior of a class? How does the Java reflection mechanism modify the behavior of a class? May 03, 2024 pm 06:15 PM

The Java reflection mechanism allows programs to dynamically modify the behavior of classes without modifying the source code. By operating the Class object, you can create instances through newInstance(), modify private field values, call private methods, etc. Reflection should be used with caution, however, as it can cause unexpected behavior and security issues, and has a performance overhead.

How to cross-domain iframe in vue How to cross-domain iframe in vue May 02, 2024 pm 10:48 PM

Ways to solve iframe cross-domain issues in Vue: CORS: Enable CORS support in the backend server and use XMLHttpRequest or fetch API to send CORS requests in Vue. JSONP: Dynamically load JSONP scripts in Vue using the JSONP endpoint in the backend server. Proxy server: Set up a proxy server to forward requests, use a third-party library (such as axios) in Vue to send requests and set the proxy server URL.

Common exception types and their repair measures in Java function development Common exception types and their repair measures in Java function development May 03, 2024 pm 02:09 PM

Common exception types and their repair measures in Java function development During the development of Java functions, various exceptions may be encountered, which affect the correct execution of the function. The following are common exception types and their repair measures: 1. NullPointerException Description: Thrown when accessing an object that has not been initialized. Fix: Make sure you check the object for non-null before using it. Sample code: try{Stringname=null;System.out.println(name.length());}catch(NullPointerExceptione){

See all articles