?
Solved

Access 2010 Auto Number and Visual Basic TextBox

Posted on 2013-02-05
7
Medium Priority
?
2,451 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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 

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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
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…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

765 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