473,398 Members | 2,812 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Question about field design when planning a VB front-end to Access database

I apologize in advance for the x-post, but I am really not sure where
this would best be addressed.

I am designing a database in MSAccess for which I want to make the
front-end in VB.

I have planned out the basic structure of the tables and fields.
However, my experience with Access is limited to doing all the work
within Access, so I have a couple of issues I'm confused about.

1) Relationships: If I want a One-to-Many relationship between two
tables based on an ID number, in Access I used the auto-number feature
and then used the lookup feature in the other table, and viola, that's
all there was to it.

In Visual Basic, will I have to maintain the relationship on my own?
Does the Access database under the application respond with an error
if there's a problem, or what?

2) I am going to be assigning a value to a table's ID field. I am
going to want to take a set of predetermined factors to generate part
of the number, and then I want the last two digits to be an increment
from the most recent entry. How is my VB form going to check to see if
this ID is unique before writing it to the database?

In this instance I can give a specific example:
InvoiceID field - Indexed, no duplicates.
This number will be a representation of the YY,MM,DD + xx where xx
will simply be incremented for each item added on that day.

Eg: Today if I generate 3 invoices, they will be assigned the IDs:
031230-01, 031230-02, 031230-03. Would I simply lookup the last number
that matches the current date and then increment by one?

I know this is a lot.. it's just my first time coding a VB app with an
Access database with relationships and ID numbers.

Thanks for any advice you can give me.
---Atreju---
Nov 12 '05 #1
2 1749
1 - Build queries in the database and fetch data from them using either a
data control or DAO, or ADO components. You may have to hand code some
queries and let your choice of data access fetch the data if you want data
that has variable criteria. There are great books by William Vaughn on ADO
(better get used to this now) that are actually fun (for a programming
manual) and you will learn almost everything you need to know about
retrieving and saving data. The first thing you have to remember when
leaving the comforts of Access.exe is that you are now "on your own" and
have to fend for yourself. All of the things you took advantage of in
Access have to be either bought or designed manually, but it's a great
experience - especially when you see how much less memory your application
is using.

2 - Once you get some queries written and learn to "ask" the database
questions using sql statements, you will be able to determine if you have
already used the id number. There are probably better ways for you to do
this...

Good luck - do a lot of reading and save the questions that you can find in
the book for the newsgroups.

--
Jerry Boone
Analytical Technologies, Inc.
http://www.antech.biz
Secure Hosting and Development Solutions for ASP, ASP.NET, SQL Server, and
Access
"Atreju" <so*****@who.hates.junkmail> wrote in message
news:qi********************************@4ax.com...
I apologize in advance for the x-post, but I am really not sure where
this would best be addressed.

I am designing a database in MSAccess for which I want to make the
front-end in VB.

I have planned out the basic structure of the tables and fields.
However, my experience with Access is limited to doing all the work
within Access, so I have a couple of issues I'm confused about.

1) Relationships: If I want a One-to-Many relationship between two
tables based on an ID number, in Access I used the auto-number feature
and then used the lookup feature in the other table, and viola, that's
all there was to it.

In Visual Basic, will I have to maintain the relationship on my own?
Does the Access database under the application respond with an error
if there's a problem, or what?

2) I am going to be assigning a value to a table's ID field. I am
going to want to take a set of predetermined factors to generate part
of the number, and then I want the last two digits to be an increment
from the most recent entry. How is my VB form going to check to see if
this ID is unique before writing it to the database?

In this instance I can give a specific example:
InvoiceID field - Indexed, no duplicates.
This number will be a representation of the YY,MM,DD + xx where xx
will simply be incremented for each item added on that day.

Eg: Today if I generate 3 invoices, they will be assigned the IDs:
031230-01, 031230-02, 031230-03. Would I simply lookup the last number
that matches the current date and then increment by one?

I know this is a lot.. it's just my first time coding a VB app with an
Access database with relationships and ID numbers.

Thanks for any advice you can give me.
---Atreju---

Nov 12 '05 #2
I thank you for your advice.

I think I am going to get a book dedicated to learning database
programming in VB.

Thanks once again!

PS - I decided to code the ID number by using a sequential ID which
gets updated on its own in a single field table to keep track of the
last number used.

I recall a colleague of mine referring to this as a "Surrogate Primary
Key" in FoxPro.
On Tue, 30 Dec 2003 21:25:12 GMT, "Jerry Boone"
<je***@antech.biz.killspam> wrote:
1 - Build queries in the database and fetch data from them using either a
data control or DAO, or ADO components. You may have to hand code some
queries and let your choice of data access fetch the data if you want data
that has variable criteria. There are great books by William Vaughn on ADO
(better get used to this now) that are actually fun (for a programming
manual) and you will learn almost everything you need to know about
retrieving and saving data. The first thing you have to remember when
leaving the comforts of Access.exe is that you are now "on your own" and
have to fend for yourself. All of the things you took advantage of in
Access have to be either bought or designed manually, but it's a great
experience - especially when you see how much less memory your application
is using.

2 - Once you get some queries written and learn to "ask" the database
questions using sql statements, you will be able to determine if you have
already used the id number. There are probably better ways for you to do
this...

Good luck - do a lot of reading and save the questions that you can find in
the book for the newsgroups.


---Atreju---
Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Mike Sutton | last post by:
I had first tried a less active PHP group, but let me try here. I searched for this, but didn't find anything that appeared related. Possibly I didn't know what to search for. I am designing a...
43
by: grz02 | last post by:
Hi, Im an experienced database+software designer and developer, but, unfortunately, anything to do with web-programming and web-systems designs is still a pretty new area to me... (been working...
5
by: Alistair | last post by:
hello again people. I'm sorry but this question is not strictly about ASP....well...not entirely..or, actually maybe it is.. I'm curious about how some of you go about laying out what you need...
7
by: Jessica | last post by:
Hi, I have a design question. I am making a time series analysis tool. Since I already use STL vector to represent time series, is there a need to implement a class for the time series object? ...
26
by: phoenix | last post by:
Hello, I've got a design question. I need to keep track of some variables and I am planning to put them inside a class or struct. Basically I'm talking about 10 bools, 20 ints and 2 arrays of...
15
by: designconcepts | last post by:
bo'jour, bo'jour, So I have question to present to the forum about OOD. This is a Csharp forum, but C# is the lang of choice and the question is an exercise based on some comments by the chief...
7
by: Bob Morvay | last post by:
I am trying to determine how far I should go in encapsulating data. As I understand it, OO practices state to create private member variables and use these variables in your publicly accessible...
16
by: Jeroen | last post by:
Hi all, I have a question which is illustrated by the following piece of code: template <class T> class A { T my_value; }; In a list, I'd like to store pointers to objects of class A....
19
by: Gilberto | last post by:
Hello I have created TWO different queries (for products belonging to FRONT and REAR) which use product information to filter the total (sum all belonging to the same category) of all the FRONT...
8
by: indrawati.yahya | last post by:
In a recent job interview, the interviewer asked me how I'd design classes for the following problem: let's consider a hypothetical firewall, which filters network packets by either IP address,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.