Solved

Access 2010 Auto Number and Visual Basic TextBox

Posted on 2013-02-05
7
2,333 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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 

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 45

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

707 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now