473,837 Members | 1,492 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1775
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.ha tes.junkmail> wrote in message
news:qi******** *************** *********@4ax.c om...
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.b iz.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
2044
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 web application using PHP, to which I am relatively new. I have seen some sites use the model whereby a single index page is created that handles authentication and receives option parameters telling the index what to load in the body of the...
43
4888
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 mostly with "legacy" environments the last 10 years) So I am writing this, hoping to get some useful advise and feedback... I have done some pretty trivial, small websites with html/PHP,
5
1298
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 to do in order to help you with the overall design of a site. My method (and I'm wondering if this is typical which is why I'm asking) is that I have a whole stack of cards about the size of an A5 sheet of paper.
7
3695
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? Right now I just use typedef vector<double>TS; Is that enough? I feel that I am not taking advantage of the C++
26
1945
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 ints. The size of the arrays would depend on some external value (going from 0 to around 1000 max). I would have an array of max 255 of these classes/structs (in most cases it will be less then 5 however) Since there's no real business logic my...
15
1873
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 designer of C#. Those of you who are junkies for design principle might be interested in contributing to this thread. I was recently reading some interviews with the chief engineer for C# (formerly Mr. Delphi), and he made an interesting comment...
7
1359
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 functions. This requires the programmer to set the variables using the setters of the class before calling the function. The problem that I see is that the coder doesn't know the private variables needed by the public function without viewing the...
16
3200
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. But I don't
19
1841
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 products belonging to every category. Same thing applies to the second query but just with products belonging to the REAR. The type of categories are the same for both queries (RED, BLUE, BLACK) and i just change the "CRITERIA" under the SEATING...
8
2241
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, port number, or both. How should we design the classes to represent these filters? My answer was: class FilterRule {
0
9682
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10881
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10628
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10275
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9406
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7004
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5850
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4475
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3126
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.