473,398 Members | 2,404 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,398 software developers and data experts.

Building A Function

194 100+
Hi Everybody.

I know my question is not a big ask for experts here and even for those poeple who have a secure knowledge about MS Access. I am using MS Access 2002 and made a database but i got stuck with Procedure Too Large error. Now i wana split my code into some functions. But I have no idea how to create functions. i have also gone through some tutorials on the web but i failed to get my required results. I need only one Function's procedure to know. if somebody will help me i will be thankful to him/her.

This Database is for a hospital and will be used for Admission and Discharge of Patients.

I made an unbound form named frmUnbound to set values into ExternalDatabase named AdmissionDischarge. I got everything right but that Procedure Too Large error discouraged me a lot.

Now there is cboCity Combo Box (Value List, Limit to List = Yes) and cboRelation Combo Box (Value List, Limit to List = Yes), designation filed (data type = string) and txtADN field (data type = string)

Combo Box cboRelation has values "Self", "Wife", "Husband","Son","Daughter", "Father","Mother","Servant".

Combo Box cboCity has Values "New York", "London", "Toronto" etc.

Designation field based on data entered into the field (text)

Now i wana make function for each Relation in way a that i can get the Admission Number. I can do other coding but can't make function that can return a value.

For example on After Update event of combo box cboRelation's is set then if cboRelation.Value = "Self", this should call a function for this relation and in this function i can run some code to return a admission number into the txtADN field of frmUnbound.

I only wana know how i can make a function to return a value into my form.

i appologize if i am failed to explain my problem cuz my english is not good.

regards

Mohammad Faisal
Nov 28 '07 #1
2 1604
Can you post the code for your attempt at a function?

Here is as simple as a function can be:

Pass a parameter of a date

Expand|Select|Wrap|Line Numbers
  1. Public Function JulianFormat(inDate As Date) As String
  2.  
  3.  
  4.     JulianFormat = Right(Year(inDate), 1) & Format(inDate - DateSerial(Year(inDate) - 1, 12, 31), "000")
  5.  
  6.  
  7. End Function
  8.  
The line:

JulianFormat = ...

assigns the value to return to the name of the function

To store the value, assign it something like:

= JulianFormat (Date())
Nov 28 '07 #2
mfaisalwarraich
194 100+
Can you post the code for your attempt at a function?

Here is as simple as a function can be:

Pass a parameter of a date

Expand|Select|Wrap|Line Numbers
  1. Public Function JulianFormat(inDate As Date) As String
  2.  
  3.  
  4.     JulianFormat = Right(Year(inDate), 1) & Format(inDate - DateSerial(Year(inDate) - 1, 12, 31), "000")
  5.  
  6.  
  7. End Function
  8.  
The line:

JulianFormat = ...

assigns the value to return to the name of the function

To store the value, assign it something like:

= JulianFormat (Date())

thank you for your reply friend.



for example if i select some value from cboRelation like if Self is selected then the code look like this:


If Me!cboRelation.Value = "Self" Then

Me!ADN = Self( ) (A function which can set ADN field of this form)

End If
Nov 28 '07 #3

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

Similar topics

0
by: Michael Ströder | last post by:
HI! I'm trying to build Python2.4 on a rather old Debian machine. I only have a shell account there. That's why I'm very limited in my actions. Building _socket fails (see below) although I...
0
by: Vidyasagara Guntaka | last post by:
Hi, I recently downloaded source code for 8.0.0 beta1. When I tried building the libpq for windows, I got some compilation errors. Following the compilation output:...
5
by: mrstephengross | last post by:
Ok, I'm working on building python 2.4.2 on cygwin. I *think* it's version 3.0 or 3.1 (is there a quick way to find out what version of cygwin is running within a shell?) Anyway, it appears to...
13
by: royaltiger | last post by:
I am trying to copy the inventory database in Building Access Applications by John L Viescas but when i try to run the database i get an error in the orders form when i click on the allocate...
3
by: skip | last post by:
I'm having no success building the curses module on Solaris 8 (yes, I know it's ancient - advancing the state-of-the-art is not yet an option) for Python 2.4. Sun provides an apparently ancient...
3
by: SMH | last post by:
Normally an SVG document is loaded/parsed/interpreted inside an HTML document using an 'object' (or 'embed') element, although there are supposedly other ways too. The problem is, the SVG document...
2
by: grant | last post by:
Man do I struggle with Enterprise Manager as a graphical tool for building views etc. Its flaky and hangs frequenlty so i have to kill it with the task manager and re open it. You cant debug...
13
by: treble54 | last post by:
I need to build PHP from source with the pdo_ibm extension and I am having an issue with it. Firstly, I am using Visual Studio .NET 2003 and I am building PHP from source through the Visual Studio...
9
by: Francis Johnson | last post by:
I've been having a discussion with some folks here about the wisdom or otherwise of "building extensibility into an API". Consider your favorite function in one of your libraries, perhaps void...
4
by: Miner Jeff | last post by:
I need to build the name of a function from data in a text file. For example, after reading the variables 'FCTN_PREFIX' AND 'FCTN_SUFFIX' from the text file, I need to execute the function: ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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.