473,503 Members | 1,726 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 2817
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
17246
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...
1
1839
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...
4
1916
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...
4
2702
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...
6
3020
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...
20
10780
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...
7
1794
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...
18
3766
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...
7
6765
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...
0
7087
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...
0
7281
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
7334
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
7462
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...
0
5579
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,...
1
5014
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...
0
3168
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...
0
1514
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 ...
0
383
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...

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.