473,466 Members | 1,393 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Leading Zero in Report

I have a database that allows the user to input a department code and
get all the employees within the department.

The table is generated from another script that places the numeric code
as a text field, which is fine.

My question is the following:

When I ask the user to input a department code, for example 8615, it
will bring up the report with the correct data, displaying the
department of "8615". However, if I use department code 2, it will
return all the correct data, displaying 2. I would like it to display
0002.

Is this possible? I played with the format function, but doesn't seem
to work since the filed is not numeric.

Mar 16 '06 #1
5 2279
> I have a database that allows the user to input a department code and
get all the employees within the department.

The table is generated from another script that places the numeric
code as a text field, which is fine.

My question is the following:

When I ask the user to input a department code, for example 8615, it
will bring up the report with the correct data, displaying the
department of "8615". However, if I use department code 2, it will
return all the correct data, displaying 2. I would like it to display
0002.

Is this possible? I played with the format function, but doesn't seem
to work since the filed is not numeric.


After you got the parameter from the user, you can "normalize" it to a 4-char
string, using the following instruction:

strParam = Right("0000" & strParam, 4)

Obviously, you may change it to suite your parameter desiderd length.

--
PBsoft di Gabriele Bertolucci
www.pbsoft.it
skype: pbsoftsolution
Mar 16 '06 #2
where exactly would this be put? In the VB script of the submit button?

Mar 16 '06 #3
> where exactly would this be put? In the VB script of the submit
button?


Sorry, but in your previous post you didn't speak about VBScript.

This is a Microsoft Access newsgroup.

Anyway, when the user clicks the button of the form, you may intercept that
event and, while parsing the form controls, I suppose you would assign controls
values to VBScript variables.
So, before assigning the value of the department code, you should use the
code I suggested you and only then sould assign it to the relative variable.

Issue: post any more question to a more appropriate group.

Bye.

--
PBsoft di Gabriele Bertolucci
www.pbsoft.it
skype: pbsoftsolution
Mar 16 '06 #4

Gabriele Bertolucci wrote:
where exactly would this be put? In the VB script of the submit
button?


Sorry, but in your previous post you didn't speak about VBScript.

This is a Microsoft Access newsgroup.

Anyway, when the user clicks the button of the form, you may intercept that
event and, while parsing the form controls, I suppose you would assign controls
values to VBScript variables.
So, before assigning the value of the department code, you should use the
code I suggested you and only then sould assign it to the relative variable.

Issue: post any more question to a more appropriate group.

Bye.

--
PBsoft di Gabriele Bertolucci
www.pbsoft.it
skype: pbsoftsolution


Mar 17 '06 #5

Gabriele Bertolucci wrote:
where exactly would this be put? In the VB script of the submit
button?


Sorry, but in your previous post you didn't speak about VBScript.

This is a Microsoft Access newsgroup.

Anyway, when the user clicks the button of the form, you may intercept that
event and, while parsing the form controls, I suppose you would assign controls
values to VBScript variables.
So, before assigning the value of the department code, you should use the
code I suggested you and only then sould assign it to the relative variable.

Issue: post any more question to a more appropriate group.

Bye.

--
PBsoft di Gabriele Bertolucci
www.pbsoft.it
skype: pbsoftsolution

I used the wrong term. I thought the "code behind" in Microsoft Access
was called VBScript. My apologies...

This is a Microsoft Access question. I guess I should have asked, "Do
I put this in the code behind"?

Mar 17 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: david | last post by:
Hi, I have an application as follows: MySQL database Back-Eend linked to MS Access Front-End and ASP Web Application. I require users to enter Serial Numbers such as: 0105123567 (10...
7
by: david | last post by:
Hi, I have 2 text boxes on an ASP form. A user enters a Serial Number in TB1 such as 0105123456, presses tab to move to TB2, TB2 then displays the value of TB1 after a calculation has been...
1
by: Joshua Ammann | last post by:
Hello, I'm trying to export a query containing contact information, including a field. Some zip codes have one or two leading zeros, for example, San Juan, PR (00927) and Springfield, MA...
5
by: Urs Beeli | last post by:
I have a question regarding errno. If I understand it correctly, including <errno.h> allows me to check "errno" for error values that some standard library functions may set. This brings up some...
2
by: chris | last post by:
Hi, I have a simple ms access application that allows you to scan barcodes in to a form which stores them in the database. The barcodes are 6 digits in length e.g. 555666 but my handheld...
5
by: GarryJones | last post by:
I have code numbers in 2 fields from a table which correspond to month and date. (Month, Code number) Field name = ml_mna 1 2 3 etc up to 12 (Data is entered without a leading zero)
8
by: Andrew Poulos | last post by:
In my limited testing with FF 2, IE 6 and Opera 9 when I divided a positive integer, that is less than 100, by 100 I get a leading zero in front of the decimal point. For example 80/100 gives...
4
by: bobm2005 | last post by:
Whatever format I try in Printf, an 'E' format number nearly always has a leading non-zero:- 1.2345E7 -9.3456E8 etc. Is it possible to force it (printf) always to have leading zero? ...
6
by: JimmyKoolPantz | last post by:
Task: Customer wants a script of the data that was processed in a "CSV" file. Problem: Zip-Code leading zeros are dropped Basically we have a client that has requested a custom script for...
1
by: lornab | last post by:
Good Afternoon I need a column to show in a report as 10 digits long by adding zero's to the left of the result. My select statement is like this: SELECT a.client, a.apar_id FROM...
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
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...
1
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
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.