Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Access 2010 Auto Number and Visual Basic TextBox

Posted on 2013-02-05
7
2,394 Views
Last Modified: 2013-03-07
Hi,

I'm having an odd problem with an access database and vb6 text box. The problem is in Visual Basic the auto number field taken from the access database displays itself as a single digit. However, on the MS Access database its shown as INV-0001 and so on. For some reason in Visual Basic is doesn't display the full story.
0
Comment
Question by:Everymancomputers
7 Comments
 
LVL 47

Accepted Solution

by:
Dale Fye (Access MVP) earned 250 total points
ID: 38855130
Well, an "autonumber" field cannot display text, so my guess is that in the Access database the form you are viewing the data in has an control source that looks something like:

="INV-" & Format([ID], "0000")
0
 

Author Comment

by:Everymancomputers
ID: 38855314
In Access I already have a format in the auto numbering field going "INV-"0000 that part is alright. This displays on the access table and incremental increase of INV-0001 and INV-0002 and so on. The problem being is this doesn't display like this in the text box I've linked within Visual Basic.

In Visual Basic the field displays as 1 or 2 but doesn't contain the whole format like INV-0001 and INV-0002 and so on.
0
 
LVL 84
ID: 38855447
<no points please, fyed has given you the correct answer>

Formats have nothing to do with the way data is stored in your table. They are for visual use only, and in fact you should not set Formats at table level (since users should never view your tables, they do nothing more that obscure the way data is actually stored in the table).

Your VB6 connection is pulling the DATA from that field - not the format. As fyed said, format it when you get it over to the form.
0
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 

Author Comment

by:Everymancomputers
ID: 38867332
I'm sorry, I still don't understand. Where does the code ="INV-" & Format([ID], "0000") go ? Is this going in the database or the Visual Basic form ?
0
 
LVL 84

Assisted Solution

by:Scott McDaniel (Microsoft Access MVP - EE MVE )
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 250 total points
ID: 38867502
In the VB form, where you load that textbox. How are you loading the textbox in VB?
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 38961168
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Read about achieving the basic levels of HRIS security in the workplace.
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

790 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question