Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Access 2010 Auto Number and Visual Basic TextBox

Posted on 2013-02-05
7
Medium Priority
?
2,491 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
[X]
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
7 Comments
 
LVL 48

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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

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 49

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

Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

Question has a verified solution.

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

Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

636 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