Введение
Задачей данной курсовой работы
является написание программы в среде Microsoft Access на языке Microsoft Visual
Basic, решающую следующую задачу: перенесение данных из таблицы Word в таблицу
базы данных.
Если говорить о среде написания
программ для решения задач - Microsoft Visual Basic for Application – то это
сочетание одного из самых простых языков программирования и всех вычислительных
возможностей такой многогранной системы, как Access. С помощью VBA можно легко
и быстро создавать разнообразные приложения даже не являясь специалистом в
области программирования. VBA содержит относительно мощную графическую среду,
позволяющую наглядно конструировать экранные формы и управляющие элементы. В
общем Visual Basic for Application позволяет с легкостью решать многие задачи.
VBA встроен в любое приложение Microsoft Office, поэтому, нет необходимости устанавливать
дополнительные пакеты прикладных программ. Тексты программ сохраняются в
соответствующих приложениях, и, следовательно, их можно переносить с одного
компьютера на другой, не задумываясь о необходимости создания исполняемых
файлов, достаточно наличия на компьютерах пакета Microsoft Office.
Visual Basic считается хорошим средством
быстрой разработки прототипов программы, для разработки приложений баз данных и
вообще для компонентного способа создания программ, работающих под управлением
операционных систем семейства Microsoft Windows.
Название Visual Basic говорит само за
себя. Visual Basic, в отличие от традиционных систем программирования,
представляет совершенно иной стиль программирования. Уже по слову
"Visual" можно догадаться, что в Visual Basic реализован визуальный
стиль программирования. Здесь мы даже не программируем, а проектируем
приложение. Наша первая задача при этом - создать рабочую среду, прежде чем
начать набирать первую строку кода.
Слово Basic в названии указывает на
то, что синтаксис программ и операторы опираются на язык высокого уровня Basic
(Beginners Atlpurpose Symbolic Instruction Code - многоцелевой код
символических команд для начинающих), но заметно от него отличается.
1. Постановка задачи
1.
Создать в базе
данных Microsoft Office Access таблицу «Закупаемые компоненты» в соответствии с
заданием
2.
Разработать форму
для работы с таблицей «Закупаемые компоненты»
3.
Написать
программу для расчета операций, указанных в задании
2.
Описание алгоритма решения задачи в виде текстового описания
1.
Создать таблицу «Закупаемые
компоненты» при помощи Конструктора и задать имя, тип, размер, формат каждого
поля таблицы
2.
Создать при
помощи Мастера форму с полями для ввода информации
3.
Поместить на
форме кнопку «Расчет»
4.
Щелкнув правой
кнопкой мыши по кнопке «Расчет», выбрать в контекстном меню строку Обработка
событий
5.
В открывшемся
окне Microsoft Visual Basic написать программу для расчета незаполненных полей
3.
Описание базы данных (структура таблиц, схема)
Таблица 1 – Описание структуры
таблицы «Закупаемые компоненты»
Имя поля |
Тип данных |
Размер поля |
Индексированное поле |
Склад |
Числовой |
Длинное целое |
Да(Совпадения допускаются) |
Изделие |
Числовой |
Действительное |
Нет |
Описание |
Текстовой |
50 |
Нет |
Наличный запас |
Числовой |
Действительное |
Нет |
Задержанный запас |
Числовой |
Действительное |
Нет |
Заказанный запас |
Числовой |
Длинное целое |
Нет |
Распределённый запас |
Числовой |
Длинное целое |
Нет |
Свободный запас |
Числовой |
Действительное |
Нет |
Единицы |
Текстовой |
50 |
Нет |
Рисунок 1 – Таблица «Закупаемые компоненты» в режиме
Конструктор
Рисунок
2– Таблица «Закупаемые компоненты
Таблица 2 – Описание
структуры таблицы «Склад»
Имя поля |
Тип данных |
Размер поля |
Индексированное поле |
Склад |
Числовой |
Длинное целое |
Да(Совпадения не допускаются) |
Тип склада |
Текстовой |
50 |
Нет |
Кластер |
Текстовой |
50 |
Нет |
Рисунок 3 – Таблица
«Склад» в режиме Конструктор
Рисунок 4– Таблица «Склад»
Рисунок 5 – Запрос в режиме
конструктора
Рисунок 6 – Запрос в режиме SQL
4. Копии с экрана форм для работы с базой данных при
разработке их в конструкторе
Рисунок 7 – Экранная форма в режиме
конструктор
Рисунок 8 – Экранная
форма
5. Текст разработанной программы
Private Sub Кн1_Click()
On Error GoTo Err_Кн1_Click
Dim rs As New ADODB.Recordset
s_sql = "SELECT [Закупаемые
компоненты].* FROM
[Закупаемые компоненты]"
rs.Open s_sql,
CurrentProject.Connection, adOpenDynamic, adLockOptimistic
With rs
.MoveFirst
Do Until .EOF
.Fields("Свободный запас")
= .Fields("Наличный запас") - .Fields("Задержанный запас")
- .Fields("Заказанный запас") - .Fields("Распределённый
запас")
.Update
.MoveNext
Loop
Me.Refresh
Exit_Кн1_Click:
Exit Sub
Err_Кн1_Click:
MsgBox Err.Description
Resume Exit_Кн1_Click
End With
End Sub
6. Подробное описание работы программы
Option Compare Database
Private Sub Кнопка1_Click() 'процедура обработки события
'On Error GoTo Err_Кн1_Click 'Значение ошибки
On Error Resume Next 'автоматическое завершение
программы при возникновении ошибки будет предотвращено и появится возможность
выполнить некоторые дополнительные действия
Dim rs As New ADODB.Recordset 'создается таблица, для каждого
столбца которой определяется тип данных и значения в этом столбце должны
соответствовать этому типу данных.
s_sql = "SELECT Spect.* FROM
Spect"
rs.Open s_sql, CurrentProject.Connection,
adOpenDynamic, adLockOptimistic 'создается динамический с оптимистической блокировкой записей
With rs 'Выполняет группу операторов для
объекта Recordset
Do Until .EOF 'повторяет блок команд, пока
условие не станет верным
.Fields(0) = fld(0) 'код специальности
.Fields(1) = fld(1) 'наименование специальности
.Update 'для сохранения изменений и
добавления записи в объект Recordset
.MoveNext 'перемещает текущую позицию в объекте
Recordset на следующую запись
Next 'выход из цикла
End With
Me.Refresh 'Обновляет объекты в семействе в
соответствии с текущими изменениями в схеме базы данных.
Exit_Кн1_Click: 'конец обработки события
Exit Sub 'конец объявления процедуры
Err_Кн1_Click:
MsgBox Err.Description 'описание ошибки
Resume Exit_Кн1_Click 'продолжает выполнение программы после завершения
процедуры обработчика ошибок
End Sub 'конец обработки события
7. Примеры работы программы
Рисунок 9 – Экранная
форма до выполнения расчета
Рисунок 10 – Экранная
форма после выполнения расчета
Заключение
база данные таблица word
В процессе выполнения данной курсовой
работы была написана программа в среде Microsoft Access на языке Microsoft
Visual Basic, решающая следующую задачу: перенесение данных из таблицы Word в
таблицу базы данных.
Список литературы
1. А.С. Грошев Информатика: Учебник для
вузов. – Архангельск, 2009.
2. А.С. Грошев Программирование на
VBS. Методические указания к выполнению лабораторных работ. - Архангельск,
2009.
Другие работы по теме:
Специфика создания баз данных и работы в Microsoft Access
Начало работы в Microsoft Access. Основные моменты создания несложной базы данных: создание титульного листа в режиме конструктор, базы данных, порядок занесения данных для базы в режиме презентации. Особенности оформления отчета и настройки программы.
Проектирование и реализация базы данных
Расчет предельно-допустимых сбросов (ПДС) для предприятий различных видов деятельности. Разработка и реализация базы данных "ПДС". Схема данных и программные тексты.
Основи інформатики та застосування ЕОМ в психології
Користування програмами Microsoft Excel та Microsoft Access, створення таблиць за допомогою конструктора, занесення в них даних про студентів та їх успішність. Створення запитів до бази, які виводять інформацію; критерії відбору інформації для запиту.
Microsoft Essay Research Paper Microsoft has had
Microsoft Essay, Research Paper Microsoft has had a couple of though months since July last year, when Judge Thomas Jackson ordered the company to break up in two. However, since the beginning of this year things have just looked better for Microsoft.
Microsoft Dilemma Essay Research Paper The Microsoft
Microsoft Dilemma Essay, Research Paper The Microsoft Dilemma During the early 1980 s, a Seattle based company named Microsoft began it s business campaign. Lead by a young computer programmer, Bill Gates, Microsoft would soon become the largest computer software maker in the world. This title did not come without a heavy price.
Does Microsoft Have Too Much Power Essay
, Research Paper Does Microsoft Have Too Much Power? Initially, there is nothing. Then, there is Bill Gates the founder of Microsoft. Once a young, eager teenager running a small business of other
External Suppliers Essay Research Paper The US
External Suppliers Essay, Research Paper The US Army Reserve Personnel Center is in need of upgrading its information technology. Currently, the workers are having trouble with their existing mainframe system, and sharing information. Documents must be printed out in order to view formats. Personnel must go the basement for printouts, and AS400 maintenance.
Should This Business Update To Windows 2000
From Windows 98 For Its Office Pcs? Essay, Research Paper Should this business update to Windows 2000 from Windows 98 for its office PCs? In the business world today, computers and the software applications that run on them basically control an well-organized business. Every major company is equipped with a computer, or network that connects through different branches throughout the firm.
The Post Office Essay Research Paper
“The Post Office” There has always been one place that has filled me with dread. Every time I walk into the post office I feel an overwhelming sense of disgust and threat. There are several reasons why the post office affects me in these ways. I feel so disgusted when I walk in the post office because often they do not have the materials I need.
Marketing Plan Essay Research Paper We live
Marketing Plan Essay, Research Paper We live in a world where consumers are demanding access to information and service anywhere, anytime, and from any device. For most people, Cell phones will be the devices, which provide them with their first access to the Internet. Time is the most precious commodity and convenience is everything.
Information Methods Essay Research Paper The aim
Information Methods Essay, Research Paper The aim of this assignment was to show and explain the value and importance of information and the tools readily accessible to us as students. We were to investigate the individual components of Access, Excel, Word and Powerpoint, then to transform, manipulate and present the information we gathered.
Why You Should Purchase A PC Essay
, Research Paper Why You Should Purchase A PC Computers are capable of doing more things every year. There are many advantages to knowing how to use a computer, and it is important that everyone
MicrisoftA Modern Monopoly Essay Research Paper Many
Micrisoft-A Modern Monopoly Essay, Research Paper Many have asked the question of whether Microsoft has turned into a monopoly of the high technology and software industry. This question is an easy one to answer, yes it is. Over the years, Microsoft has used its wealth and influence over the software industry to pull away from the competition by threatening competitors of withdrawing contracts and software deals.
Untitled Essay Research Paper Computers are capable
Untitled Essay, Research Paper Computers are capable of doing more things every year. There are many advantages toknowing how to use a computer, and it is important that everyone know how to use themproperly. Using the information I have gathered, and my own knowledge from my 12 years ofcomputer experience, I will explain the many advantages of owning a computer and knowing
Information Technlogy And Hack Essay Research Paper
Hacking has become a major issue in today s world of technology. Even software giant Microsoft has been affected. Recently hackers broke into Microsoft s computer system. The hacker or hackers created new accounts so that they could gain access to parts of the software giant s computer network. Some accounts were being created that did not match or normal audit logs, Mr.
Comparing Operating Systems Essay Research Paper Comparing
Comparing Operating Systems Essay, Research Paper Comparing Microsoft Operating Systems : 95/98/NT This report is centered on the similarities and differences of the three major operating systems provided by Microsoft during the previous decade. There were and will always be changes and upgrades some of the information may not be current, as these systems have had certain upgrade modules that may not covered.
Database Design Essay Research Paper Before you
Database Design Essay, Research Paper Before you use Microsoft Access to actually build the tables, forms, and other objects that will make up your database, it is important to take time to design your database. A good database design is the keystone to creating a database that foes what you want it to do effectively, accurately, and efficiently.
Computer Programming Language Essay Research Paper IntroductionBackground
Computer Programming Language Essay, Research Paper Introduction Background information of the company PDP systems is a computer memory manufacturer and peripheral distributor with a corporate office located in Fremont California. The company consists of 9 departments and 160 employees with 80 networked computer users in the corporate office.
Computer In Buisness Essay Research Paper The
Computer In Buisness Essay, Research Paper The personal computer has changed the way the world does business. Through the possibility of customers being able to access the Internet, They
Computer Fundamentals Essay Research Paper The very
Computer Fundamentals Essay, Research Paper The very first operating system used on the earliest IBM PCs was called simply the Disk Operating System, abbreviated DOS. There are few PC users who have not heard of DOS; at one time it was used on pretty much every PC, and it is still around today in many different forms.
Microsoft Antitrust Court Case Essay Research Paper
As this paper is written there is a landmark court case proceeding in Washington in front of a federal judge. This case involves the charging of the Microsoft Corporation for violating antitrust laws set up by the government to preserve market competition. A general overview of the accusations brought against Microsoft by the Justice Department was given by Hayes in the Scholastic Update article The U.S. versus Microsoft (1999).
Microsoft Essay Research Paper Microsoft the world
Microsoft Essay, Research Paper Microsoft, the world’s largest company by market value, is accused of acting monopolistic in the computer software industry. Microsoft provides for eighty percent of the computers used, operating system. The operating system is a basic program that loads or boots up your computer to make it perform.
Microsoft Monopoly Essay Research Paper By now
Microsoft Monopoly Essay, Research Paper By now everyone is familiar with the case U.S. vs. Microsoft. What is all this about? According to my two articles, Microsoft, the world’s leading software company, is being sued by the Justice Department joined by 19 states.
No Modern Camelot Essay Research Paper No
No Modern Camelot Essay, Research Paper No Modern Camelot Kennedy was a man obsessed with his image while Arthur was a man obsessed with ideas he had to make his society grow.
Microsoft Antitrust Editorial Essay Research Paper Microsoft
Microsoft Antitrust Editorial Essay, Research Paper Microsoft: The Big Bully Stealing Your Lunch Money A monopoly, by definition, is a business or group that engages in unfair and often unethical business practices to control an industry and eliminate all competition that might lessen their profits.
Why I Own A Computer Essay Research
Paper COMMUNICATIONS COMPUTER SCIENCE WHY I OWN A COMPUTER What can a computer do for me? At my age, why do I need to learn about the Internet? Answers; a lot, and yes. Computers are capable of doing more things every year. There are many advantages to knowing how to use a computer, and it is important that everyone know how to use them properly.
Microsoft The Company Essay Research Paper Microsoft
Microsoft The Company Essay, Research Paper Microsoft: THE COMPANY The thought of forming a company which supplies its customers with software, was a great idea–especially coming from a college dropout. Bill Gates, along with high-school friend Paul Allen, formed a software company in 1975. From the beginning, Microsoft had a tremendous potential to become a very successful corporation.
Cold Fusion Essay Research Paper Allaire
Cold Fusion Essay, Research Paper Allaire’s ColdFusion studio and server package allows web developers to create database driven applications. ColdFusion is server side scripting that utilizes Microsoft ODBC drivers to access system databases. This allows ColdFusion to produce dynamic pages generated real time by the server.
Microsot Word 2000 Essay Research Paper Name
Microsot Word 2000 Essay, Research Paper Name and Type: -Microsot Word 2000 -Word Processor Producer/Maker: -Microsoft Corporation -The creator of the popular Windows operating system founded by Bill Gates.
World War 2 Essay Research Paper Windows200
World War 2 Essay, Research Paper Windows200, SmartSuite, and CorelDraw v.9 Windows200, SmartSuite, and CorelDraw v.9 are three great computer products that huge firms such as Microsoft, Lotus, and Corel build high hopes on. The products mentioned above are the latest creation of these big firms, and they are willing to invade the computer software markets using these software.
Табличний редактор Microsoft Excel
Теоретичні відомості 1.1. Табличний редактор Microsoft Excel Microsoft Excel – це складова частина пакето-прикладних програм Microsoft Office. Microsoft Excel – призначений для створення електронних таблиць і найбільшою перевагою є можливість досліджувати, аналізувати дані і виконувати обчислення.