[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Access 2010 Auto Number and Visual Basic TextBox

Posted on 2013-02-05
7
Medium Priority
?
2,508 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
6 Comments
 
LVL 49

Accepted Solution

by:
Dale Fye earned 1000 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 85
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 85

Assisted Solution

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

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In this article, I’ll look at how you can use a backup to start a secondary instance for MongoDB.
Windows Explorer let you handle zip folders nearly as any other folder: Copy, move, change, and delete, etc. In VBA you can also handle normal files and folders, but zip folders takes a little more - and that you'll find here.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

872 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