Advertisement

06.06.2008 at 04:17AM PDT, ID: 23463286
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.8

How do I pass values from multiple fields into one field as a string and specify the format of that string?

Asked by rbbarch in Access Coding/Macros, Access Forms

Tags: , , ,

Hello,

In my Access database, I have a table with a list of photographs which are either taken in Black & White, Colour Slide, Colour Print, or Digital.  Each type of film can have more than one roll of film associated with it.

When a user has entered the required data on the form and has clicked a button to confirm this,  I want to create an unique ID number from a combination of three fields: FilmType (BW, CS, CP or DP), FilmNo (currently as an integer)  and the PhotoNo (again an integer).  I want to create a format of the type "BW03056", or "CS01345", where BW etc = film type, the two digit number  "01, 02" etc. = film number (no more than 99 films will be used), and the three digit number  "012", "346" etc. = photo number.  This String will also be used to rename the photos as they are scanned in, allowing them to be clearly referenced when they come to be archived (hence AutoNumber is not an option).

I am fairly new to VBA, and while I can create a unique Photo ID using the following code, I do not know how to ensure each ID is in the format outlined above:

Private Sub Command42_Click()

    Dim strFilmType As String
    Dim intFilmNo As Integer
    Dim intPhotoNo As Integer
   
    strFilmType = FilmType
    intFilmNo = FilmNo
    intPhotoNo = PhotoNo
   
    PhotoID = strFilmType & intFilmNo & intPhotoNo

End Sub

Another issue is that digital photographs will not have a film number, and in this case, I want it to accept '0' in the 'FilmNo' field, and pass this to the PhotoID field as "00".  I know I need to create an 'on error' condition in this sub, I just haven't done that yet.

I hope this is clear.  Thank you in advance for your help.

RebeccaStart Free Trial
[+][-]06.06.2008 at 04:36AM PDT, ID: 21727983

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Access Coding/Macros, Access Forms
Tags: Microsoft, Access, 2003, VBA
Sign Up Now!
Solution Provided By: matthewspatrick
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628