Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 1 / March 2006

Tip: Looking for answers? Try searching our database.

Leading Zero in Report

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Drum2001 - 16 Mar 2006 19:28 GMT
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.
Gabriele Bertolucci - 16 Mar 2006 19:43 GMT
> I have a database that allows the user to input a department code and
> get all the employees within the department.
[quoted text clipped - 12 lines]
> 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
Drum2001 - 16 Mar 2006 19:45 GMT
where exactly would this be put?  In the VB script of the submit button?
Gabriele Bertolucci - 16 Mar 2006 20:22 GMT
> 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
Drum2001 - 17 Mar 2006 21:17 GMT
> > where exactly would this be put?  In the VB script of the submit
> > button?
[quoted text clipped - 17 lines]
> www.pbsoft.it
> skype: pbsoftsolution
Drum2001 - 17 Mar 2006 21:19 GMT
> > where exactly would this be put?  In the VB script of the submit
> > button?
[quoted text clipped - 17 lines]
> 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"?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.