473,406 Members | 2,387 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

I want to view the VB code of my MS Access Database 2007?

Is there any way i can view the VB code of all the objects i created in my MS Access Database?; in the Event Procedure of any object; it only shows me the events; not the actual design?

p.s. i created the DB using wizards

You see i created this MS Access Database (assignment) using wizards to create all my Tables; Forms; Queries and Reports ; now my teacher is asking for the VB code (the object design code); i can get to the SQL commands for forms and queries but not the actual design code of a certain object for example (from another database)

Expand|Select|Wrap|Line Numbers
  1. Private Sub Label15_Click()
  2.  
  3.  
  4. 'purges the work file of the previous month
  5. DoCmd.OpenQuery "Purge Work File"
  6.  
  7. 'updates the work file with pay summary
  8. DoCmd.OpenQuery "Append to Temp"
  9.  
  10. 'opens the tax file
  11. Set a = CurrentDb.OpenRecordset("Tax")
  12.  
  13. 'opens the work file
  14. Set b = CurrentDb.OpenRecordset("Temp work")
  15.  
  16. 'updates the tax file
  17. Do While Not b.EOF()
  18. a.MoveFirst
  19.  
  20.     Do While Not a.EOF()
  21.  
  22.         If b.[Net Pay before tax] < a.[Income] Then
  23.             Exit Do
  24.  
  25.         End If
  26.  
  27.         a.MoveNext
  28.     Loop
  29.  
  30.     b.Edit
  31.     b.[Tax] = a.[Tax]
  32.     b.[Net Pay after tax] = b.[Net Pay before tax] - b.[Tax]
  33.     b.Update
  34.     b.MoveNext
  35.  
  36. Loop
  37.  
  38. 'closes the tax file and the work file
  39. a.Close
  40. b.Close
  41.  
  42. End Sub
is there a VB code for my DB in the first place?; i can send you the database if u like; but i dont think it attached here; skype: doaa.bayoumy
Apr 5 '11 #1
5 22131
Okk
First of all when you create a Database no code is associated with it.

Open your database file, then hold the Alt Key and press F11. A window will open (Microsoft Visual basic) enviroment platform. where you can write code.

The code you have provided in your question, is associated to a group of controls, like buttons, comboboxes, and other controls.

Coding is associated with events, in your database you have no events which means you have no code.

which access you are using 2003?? 2007 ??
Apr 5 '11 #2
TheSmileyCoder
2,322 Expert Mod 2GB
Hi doaa bayoumy and welcome to BYTES.

As such, a starting standard database will not come with Visual Basic code.

You can then start adding command buttons, or adding code to certain events to expand the functionality of your database. The code you posted is an example of such.

The normal loading/unloading and saving of records is all handled by access behind the scenes and that part of the code is not visible. Again you can choose to modify the standard saving by using unbound form, and use your own code to handle the loading and saving of records.
Apr 5 '11 #3
I am using Access 2007; i will try your answer now
Apr 5 '11 #4
As a start to let u see whats going on :
1)select one ofthe forms in your database
2)open it in design view
3)Select the button control from the toolbar
4) draw a square on your form
5)Click cancel if the Command Button Wizard window appear
6) Select event from the Property Sheet of that button
7) Point to OnClick
8) click on the dotted button next to it
9) a Choose Builder will appear
10) double click on Code Builder

And here you are , this represents will show you the code behind this button.

you can code whatever you need here . so that when that button clicked on your form the code will run.

hope that helped as a start :)
Apr 5 '11 #5
thanks alot Scorp this really did help; i guess i will have to invent some type of Event to make my teacher happy "he wants to see a code" embeded macros are not enough!

Thanks alot
Apr 5 '11 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Bob Davies | last post by:
I have upsized an Access database into SQL Server and manged to get the data in place ok. The wizard created an Access Project which I have started to modify. However, I am also trying to get...
7
by: RCS | last post by:
Okay, a rather 'interesting' situation has arisen at a place I work: I need to convert a database from Access to something that can be used over the web. I am currently maintaining and...
12
by: Wadim Grasza | last post by:
I want to store and display (on a form or a report) multiple pictures per record in an access database. The pictures are not stored within the database. They are stored as files and the database...
0
by: Namratha Shah \(Nasha\) | last post by:
Hey Guys, Today we are going to look at Code Access Security. Code access security is a feature of .NET that manages code depending on its trust level. If the CLS trusts the code enough to...
3
by: Russell Read [MSFT] | last post by:
Hi all, I am using VB script in ASP to access a MS Access database. This works fine until I want to access the same db placed on a file share. The code I am using is... 'create connection...
0
by: Fernando Lopes | last post by:
Hi there. I'm using the DAAB in my app. So, if I need to fill a dataset, using a SQL Server database, I use the following code helper.FillDataset(conn, "GetCustomersByID", ds, new string {...
5
by: Seok Bee | last post by:
Dear Experts, I currently trying to use the FileUpload control from asp.net 2.0 to upload files. The uploading of the file I would like to store it in the Access Database. Unfortunately, I've no...
9
by: Wayne Smith | last post by:
I've come up against a major headache that I can't seem to find a solution for but I'm sure there must be a workaround and I would really be grateful of any help. I'm currently building a web...
2
9815402440
by: 9815402440 | last post by:
hi i want to connect access database which is on remote server (web server). can anybody please tell how to do this? thanx in advance. manpreet singh dhillon hoshiarpur
14
by: SimeonD | last post by:
Hi I have an access database called Sales.Mdb In vb.net 2005, I'd like to open it. Which I can do. What I can't figure out is how to figure out if Sales.Mdb is open already. If so, I want to open...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.