473,657 Members | 2,624 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Unbound data entry for more than 1 table

4 New Member
Hello, I am quite new to access, but seem to be getting there now. I am producing a database, and I want to make a data entry form that is not bound to a table, as I do not want half completed records to be saved to the database.

I have used a append query for where I have information going into one table, and this worked great.

What I am trying to do now though, is have a data entry form for a main table 1, as well as another table 2 that has a one-to-many relationship. The common field is called ‘SchemeID’ which is an ‘autonumber’ in table 1, and a ‘number’ in table 2 (to enable more than one record to be stored [in table 2] for each of the main records [in table 1]).

Therefore my overall goal is a form/forms that can enter a single record onto the table 1 without saving (until the db is told to), and also be able to add multiple records to the table 2 (again, not until the db is told to do so), but the records in table 2 need to have the same autonumber that is generated from table 1.

I hope this makes sense! Can anyone think of an easy way to achieve this? Many thanks
Jul 9 '08 #1
2 2826
missinglinq
3,532 Recognized Expert Specialist
I think you really need to rethink your entire project! Using unbound forms for data entry negates one of Access' best features, the ability to automatically save records with almost no effort. Saving records thru unbound forms is certainly are not something to be attempted by an admitted Access newby!
Expand|Select|Wrap|Line Numbers
  1. I am producing a database, and I want to make a data entry form that is not bound to a table, as I do not want half completed records to be saved to the database.
You don't need an unbound form to prevent half completed records from being saved! You simply place validation code in the Form's BeforeUpdate event to check the required fields, and cancel the save if there are fields missing data. Here’s some typical validation code:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_BeforeUpdate(Cancel As Integer)
  2.   If IsNull(Me.Field1) Then
  3.     MsgBox "Field1 is a required field and cannot be empty!"
  4.     Cancel = True
  5.     Me.Field1.SetFocus
  6.     Exit Sub
  7.   End If
  8.   If IsNull(Me.Field2) Then
  9.     MsgBox "Field2 is a required field and cannot be empty!"
  10.     Cancel = True
  11.     Me.Field2.SetFocus
  12.     Exit Sub
  13.   End If
  14. End Sub
What I am trying to do now though, is have a data entry form for a main table 1, as well as another table 2 that has a one-to-many relationship. The common field is called ‘SchemeID’ which is an ‘autonumber’ in table 1, and a ‘number’ in table 2 (to enable more than one record to be stored [in table 2] for each of the main records [in table 1])
Bound forms/subforms.are used for this exact purpose! The main form holds the 'one' side of the relationship and the subform holds the 'many' side.

and also be able to add multiple records to the table 2
Unbound forms only hold one record at a time. Actually they don’t hold “records” at all, they hold data that can then be committed as a record in a table. You have to enter data for one record at a time, then save it, before you can ebter data for another record. You cannot enter data multiple records, as you do in a bound form.

Can anyone think of an easy way to achieve this?
There is no easy way to achieve this using unbound forms! Re-evaluate your project, keeping these things in mind, and let us know when you need help.

Welcome to Bytes!

Linq ;0)>
Jul 11 '08 #2
DWHTHS
4 New Member
I think you really need to rethink your entire project! Using unbound forms for data entry negates one of Access' best features, the ability to automatically save records with almost no effort. Saving records thru unbound forms is certainly are not something to be attempted by an admitted Access newby!
Expand|Select|Wrap|Line Numbers
  1. I am producing a database, and I want to make a data entry form that is not bound to a table, as I do not want half completed records to be saved to the database.
You don't need an unbound form to prevent half completed records from being saved! You simply place validation code in the Form's BeforeUpdate event to check the required fields, and cancel the save if there are fields missing data. Here’s some typical validation code:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_BeforeUpdate(Cancel As Integer)
  2.   If IsNull(Me.Field1) Then
  3.     MsgBox "Field1 is a required field and cannot be empty!"
  4.     Cancel = True
  5.     Me.Field1.SetFocus
  6.     Exit Sub
  7.   End If
  8.   If IsNull(Me.Field2) Then
  9.     MsgBox "Field2 is a required field and cannot be empty!"
  10.     Cancel = True
  11.     Me.Field2.SetFocus
  12.     Exit Sub
  13.   End If
  14. End Sub

Bound forms/subforms.are used for this exact purpose! The main form holds the 'one' side of the relationship and the subform holds the 'many' side.



Unbound forms only hold one record at a time. Actually they don’t hold “records” at all, they hold data that can then be committed as a record in a table. You have to enter data for one record at a time, then save it, before you can ebter data for another record. You cannot enter data multiple records, as you do in a bound form.



There is no easy way to achieve this using unbound forms! Re-evaluate your project, keeping these things in mind, and let us know when you need help.

Welcome to Bytes!

Linq ;0)>
Hello, many thanks for the advice, your way loooks better/easier than what I was trying to do!

Dave
Jul 18 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

11
17276
by: deko | last post by:
I need to create different recordsets based on queries that use data from unbound fields in a form. I've discovered that I can't do this, and instead need to save the data in question (usually a text string) to a table. I'm thinking the best way to do this is to use a Make Table query -- that way the table stays small -- one row -- and there is less chance for something to get overwritten. But how to create a make table query from...
1
1846
by: InDeSkize | last post by:
Hello my programming Super Heroes. I think this one is a no brainer, me being the one with no brain. I have a form that is used for data entry. The goal is to have an unbound form that only enters the record when you hit the "Save Record" button. I've been using a form that enters right into the table, and I'm running into too many problems with Multiple Primary Keys and
4
1926
by: Bill Stock | last post by:
The few times in the past that I've loaded unbound data, I've tended to cheat and use temp tables (not really unbound) or use code for small datasets. I'm currently involved in a project that has numerous tables in the 200 column range, with several thousand rows of data. A consulting review prior to my involvement stressed the wasted space and database speed as the major impetus for normalization. Although the db actually works fairly...
4
2708
by: Robert | last post by:
Have main form with an unbound subform1 which is used for data entry. Subform1 has a nested continuous unbound subform (subform2) which is used to enter multiple records related to the record being entered in subform1. Am using DAO method to save the records entered into subform1 & 2 into the underlying tables (table1 & table2). Record being entered in subform1 only gets its unique identifier when saved to underlying table (primary key...
6
3028
by: jean.ulrich | last post by:
Hi I have a form that is not related with a table neither a query (unbound form) On this form I have a text field where the user can put a text or a number As I dont want to create a table just for that field, is it possible that when someone write someting in the field, the text don't disapear when he close the form and open it again
20
10807
by: Robert | last post by:
Need some help to stop me going around in circles on this one.... Have a nested subform (subform2) which simulates a continuous form for the record on the parent subform. Subform2 has rows of either an option button plus two text fields or a checkbox plus two text fields Am wanting to save the user entries into an underlying table. Tag property for each option button, check box or text field has the value of the key
7
1801
by: Max | last post by:
I've included the needed tables in the DataSource. Those tables that are bound to controls I can workwith. But how do you get access to the DataAdaptors that are not bound? me.Dataset1.table is a table with no Insert or Update methods. pll.DataSet1.table has the Row, ChangeEvent, and ChangeEventHandler. It seems like it should be fairly straight forward to use the DataAdapter without binding it to a control. How do you do this?
18
3784
by: TORQUE | last post by:
Hi, Im wondering if anyone can help me with a problem. I have a form with more than 50 unbound fields. Some of the fields will be blank from time to time. This seems to be where im having trouble. I have tried keeping some of the fields bound and when I use the save button it has been saving as 2 different records. This is unacceptable. This is what I have, can anyone help me out with this?
7
6786
by: ARC | last post by:
I've noticed that if you use code for the before update command for unbound controls, it doesn't really work. I tried the following: Me!ExportedYN.undo Cancel = True DoCmd.CancelEvent Exit Sub
0
8407
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8739
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8512
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
7347
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...
1
6175
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5638
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
4171
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4329
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1969
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.