How To Prevent Widow Records?

Dec 13, 2005

What is the best way to prevent widowed records? By widow record I mean records in the parent table that do not have a related record in the child table.

I have a tblOrder that is linked to a tblProductOrder by the OrderID field. I don't want the user to be able to create a record in tblOrder without adding some products to the order, which will be stored in tblProductOrder.

Thanks for the help.

View Replies


ADVERTISEMENT

How To Prevent Duplicate Records?

Jan 13, 2007

i am using a textbox in the main form to transfer the Yr/Mth into the table. (refer to qp.zip)

now my problem is, how do i prevent duplicate records into the table?

e.g: currently whenever i scroll ard the months control in the form, i will get duplicate Mth/Yr into the table. how do i prevent that from happening?

i only want to have updated data inside the Mth/Yr table instead of duplicated Mth/Yr

Public Sub PutInMonthlyRecords()

Dim sql As String
Dim Db As DAO.Database
Dim rs As DAO.Recordset
Dim f As Form
Dim MthYr As String

Set f = Forms!frmQpi

MthYr = f("txtMthYr")

sql = "SELECT * FROM [tblQpiMonthly] WHERE (([tblQpiMonthly].[Input MthYr] = 'MthYr' ));"

Set Db = CurrentDb()
Set rs = Db.OpenRecordset(sql)


If rs.RecordCount = 0 Then
If (f!txtTotalPF) = 0 Then
Exit Sub
End If

rs.AddNew
rs![Input MthYr] = f("txtMthYr")
rs![Monthly TotalPF] = f("txtTotalPF")
rs![Monthly Rejection] = f("txtTotalAvoid")
rs![Monthly TotalAvoid] = f("txtRejection")

rs.Update

Else
If (f!txtTotalPF) = 0 Then
rs.Delete

Exit Sub
End If


rs.Delete
rs.AddNew
rs![Input MthYr] = f("txtMthYr")
rs![Monthly TotalPF] = f("txtTotalPF")
rs![Monthly Rejection] = f("txtTotalAvoid")
rs![Monthly TotalAvoid] = f("txtRejection")

rs.Update

End If


Db.Close

End Sub

View 1 Replies View Related

Way To Prevent Deletion Of Records?

Mar 24, 2007

I have a database with several forms, tables, queries etc. and it works fine. One of the users of the database accidentally deleted a record which was displayed by a query. I have selected AllowDelections = No in all object properties. Despite this, the record got deleted. Is there a way to prevent such deletions? Kindly help.

View 1 Replies View Related

Prevent User From Seeing Other Records

Apr 7, 2008

I have a form, that once prompted, finds a certain record for the user. How do I prevent the user from being able to see any other records but that one, once the form is opened? The user needs to be able to edit the particular record they opened, without viewing or editing any other records in the database. Is there a way to hide the bar at the bottom of the form that allows users to manipulate through the different records?

View 6 Replies View Related

Prevent Entry Of Duplicate Records

Apr 17, 2008

I am using a data entry form to enter new data into one of the tables.How can we prevent entry of duplicate records? Duplicacy shall be checked on the first two fields only.
Please help.
regards
bijon

View 6 Replies View Related

Prevent The User From Editing Records

May 8, 2005

Hey guys..

is there any way in which i can prevent the user operating a form from adding or deleting or editing any records ?

View 10 Replies View Related

Delete Or Prevent Records After Cbo Change ?

Sep 5, 2006

Hello, I HAVE searched the forums for many days but I could not find a solution. Maybe I'm not sure what to look for...

The MAINFORM_1(single form view) is based on a Query and has a cbo named 'cbo_client'. This cbo is for a field named [client_id]. The AfterUpdate [event] of 'cbo_client' does a requery on a field in the the following SubForm:

In the SUBFORM_1(datasheet) (based on another Query) is another cbo named 'cbo_subclient', with a select statement of 'Select (all the needed fields) FROM tbl_subclient WHERE ((([tbl_subclient].[subclient_id])=[Forms]![mainform_1]![cbo_client])).

Everything (incl. the REQUERY) works fine, and all the tables gets updated with the records the way it should. No problems.

But this is where i get stuck...: Once the user has entered data in the SUBFORM_1 datasheet, and then >changes the 'cbo_client'< on the MAINFORM_1, it requery the subform like it should, BUT the previously entered data in the subform is already written to the table!

So, I need a way to prevent the data in the subform from beiing stored if the user changes the cbo on the mainform (for a second time). OR prevent the cbo on the mainform from beiing changed after the subform is completed.

I hope you understand what I'm trying to do...

Please, just a point in the right direction and i'll battle it out from there.

Thank you.

View 5 Replies View Related

Prevent Insertion Of Blank Records

Nov 27, 2006

I have a form that is opened by the following code:
Private Sub Status_AfterUpdate()
If Status.Value = "WIP - Snagged" Or Status.Value = "WIP - Suspended" Then
DoCmd.OpenForm "NotesJobChanged", , , acFormAdd
Forms!NotesJobChanged!txtJobNo.Value = Me!txtJobNo.Value
Forms!NotesJobChanged!Date.SetFocus
End If

This 'NotesJobChanged' form has three text boxes on it - JobNo, Date & Note. The JobNo is autofilled from the code above. If nothing is entered into the other fields and the form is closed this record is entered into the database with only the JobNo filled in.

What I want is a way to force the user to enter data into these fields. I don't want to set the 'Required' property of the field to yes as it generates an awful system error message. If the user attempts to close the form without filling it out can they be reminded that they have to, but with an option then to close the form if they really don't want to enter any data? If they do chose to close without filling it out can it be prevented from being added to the database.

Hope this makes sense :)

Many thanks in advance

Michael

View 1 Replies View Related

Forms :: Prevent Duplicate Records

Oct 16, 2013

the proper code to prevent duplicate records in my form?

I'm using:

Private Sub Ctl_Lname_BeforeUpdate(Cancel As Integer)
Dim dupCount As Long
dupCount = DCount("*", "Clients", "[LastName]= '" & Me.[LastName] & "'" & " And " & "[PreferredName] = '" & Me.[PreferredName] & "'")
If dupCount <> 0 Then
Beep
MsgBox

[code]....

"This name already exists in the database. Please check that you are not entering a duplicate person before continuing.", vbOKOnly,

View 10 Replies View Related

Tables :: Many To Many Relationships - Prevent Same 2 Records From Being Associated Twice

Sep 12, 2012

I'm learning how to do Many to Many relationships and I think I've got the basic idea down, I am just not sure how to prevent the same 2 records from being associated twice.

For example:

My practice database deals with Authors and Books.

I was able to set it up so that Mike Gunderloy and Susan Harkins are both Authors of the book: "Upgrader's Guide to Microsoft Office System 2003".

I was also able to set it up so that Mike Gunderloy and Susan Harkins are both Authors of the book: "Automating Microsoft Access 2003 with VBA".

The thing I want to prevent is something like this:

Book:
- Automating Microsoft Access 2003 with VBA

Authors:
- Mike Gunderloy
- Susan Harkins
- Susan Harkins (Duplicate)

And vise versa

View 5 Replies View Related

Prevent Duplicate Entry In Records

Jan 27, 2014

I am trying to prevent a user entering duplicates of date and time in an appointments table for the same doctor..how do I do this?

View 3 Replies View Related

How To Lock Records To Prevent User Editing?

Feb 6, 2008

Good morning! I'm building a database for use by four technicians in a call-center type operation. The call records are purely transactional in nature -- once the call has been logged, the record is closed. If the customer calls again, a new record is opened.

The supervisor doesn't want the techs to be able to go back and edit a record once it's entered -- the records are for quality-control purposes and he doesn't want them gaming the system by going back and changing things after the initial call is logged (let's not discuss the issue of employee psychology, motivation, Office Space, etc.). So I'm trying to figure out how to do that; they all have wheel mice, and I can currently see all the records as I scroll back and forward with my mouse wheel, so I'm assuming they'll be able to, as well.

Any help?

Thanks,
Andreas

View 11 Replies View Related

Forms :: Filter To Prevent Repeating Records

Aug 7, 2015

I need to create a form and report. I created a Form now (i want to Report too.) but i saw, some field records are repeating themself.

I give an example :

ID Group Project Name Maintainers
1 A X-File Top-Secret Saruman
1 B X-File Top-Secret Gandalf
1 C X-File Top-Secret Radagast

On my report or form i want to see only :

ID: "1"
Group: "A" , "B" , "C"
Project: "X-File"
Name: "Top Secret"
Maintainers: "Saruman" , "Gandalf" , "Radagast"

Is that possible to filter records like that ? and How ?

View 3 Replies View Related

Forms :: Prevent Duplicate Records From A Form?

Nov 12, 2013

Im trying to prevent duplicate records based on a PO # (RA_PO_Nbr), entered from a form. I'm trying to throw a 3022 error when the user attempts to enter a record that already exists, but I dont necessarily have to do it this way.

Code:
Private Sub cmdSubmit_Click()
On Error GoTo cmdSubmit_Click_Error
Dim db As Database
Dim rst As DAO.Recordset
Dim strSQL As String
strSQL = "CompanyPOTable"

[code]....

View 7 Replies View Related

How To Prevent Duplicating Records When Importing Data

Oct 14, 2011

We are a travel company and I am just setting up a new database with two tables - [Client_Table] & [Enquiry_Table].

Most exisiting clients call in when they want to make a new enquiry so the 'user' can go it to a form which creates a 'new enquiry' for that client.

We also download 'new enquiries' from our website. This data includes info that goes in to the [Client_Table] and [Enquiry_Table]. They download in to a XL spreadsheet. Currently I copy and paste the data (not sure if there's a better way) from the XL speadsheet in to a query. This query creates a new client record & a new enquiry record which are both linked by a primary key [Client_ID].

This all works however the problem I have is that sometimes existing clients enquire through the website. They do fill in a field to say they're an existing client but if I paste them in to the query as explained above it creates a duplicate client record.

The only way around this I can think of is it to take out any exisitng clients from the XL spreadsheet first, search for their Client_ID and then paste these enquiries seperately with their Client_Id's in to different query which only adds a new record to the [Enquiry_Table] and links them to their exisitng record in the [Client_Table].

View 3 Replies View Related

Prevent Duplicate Records For Calculated Field

May 3, 2013

I have a table for storing vehicles. The table contains the following fields:

VehicleID
Make
Model
Trim
Build Date Begin
Build Date End

Vehicle Name - a concatenation of 'Make' 'Model' 'Trim' 'Build Date Begin' and 'Build Date End'

The 'Vehicle ID' is the primary key, the rest of the fields can't be indexed with no duplicates. Is there a way of preventing one from saving a duplicate VehicleName on the table since it is a calculated field.

View 3 Replies View Related

Prevent Duplicate Records Based On Multiple Fields

Nov 15, 2005

how or what function (DLookup) should I use to prevent duplicate records based on multiple fields? I want to look at data in three fields that can't match existing data in those three fields. It's ok if one or two of the fields match but not all three.

View 2 Replies View Related

General :: Lock Archived Records To Prevent Editing?

Dec 12, 2012

I want to lock archive records so that they can't be edited, however I want them available to users for viewing. So for example if the file is "closed" the record can not be changed.

View 5 Replies View Related

Modules & VBA :: Prevent Deletion Or Changes To Records That Meet Certain Conditions

Jun 14, 2013

Been experimenting on some code to prevent deletion or changes to records that meet certain conditions.

The problem I am having is the code is contradicting each other preventing some of the records to be locked down.

Code:
Private Sub Form_Current()
'Code 1 - Prevent edits if 21 day period has lapsed
If TestDate2(Me.txtStartedHidden) > 0 Then
MsgBox "Editing NOT allowed - 21 day time period has been reached"
Me.txtBasic.Locked = True

[Code] ....

Rules are:

Edits allowed if invoice date not reached
Edits allowed if within 21 day but NOT if invoice date is reached

Edits prevented if invoiced date reached and if records still within 21 days
Edits prevented if invoiced date reached & records past 21 days

View 2 Replies View Related

Tables :: Prevent Adding Records If Already Exists On Another Table

Jan 2, 2013

Table in my access 2010 is configured to have a unique records (no duplicates)which has now records more than 2000 so i copied the table and pasted Structure only. what i would like to have is that new table which presently is empty should not add any record which is already available in old table. While entering data in new table i would like users to see the error if they try to enter the record which was previously entered in old table.

View 8 Replies View Related

Modules & VBA :: Prevent Duplicate Records To External CSV File From Form

Nov 24, 2014

I have some code which creates a record in an external csv file to provide information to upload a vehicle to the website. It works fine with the exception of creating duplicates when, for example an option to amend a record is given to the user before continuing to a new record. The option has to be in place in case there is an error in the specifics of what is important to be recorded in the database and under such circumstances the form code allows the user to tab through the form and correct any errors, but this creates duplicate entries in the csv file as the user has to pass through the 'SavePrintVehPurch_Exit' button a second time after corrections are made.

I am wondering if there is a way of altering the following code to effectively look look to see if the csv record exists and if so correct any changed field information rather than create a whole new record or create a new record where the record does not exist - The record in the csv file is determined by the 'Me.VP_VehRegMark.Value '.

Private Sub SavePrintVehPurch_Exit(Cancel As Integer)
Dim fileText As String
Dim fileName As String
Dim fileNumber As String
fileNumber = FreeFile

[Code] ....

I am wondering about introducing the something like the following ( but can't work out how to clarify comparison of the fields)

If Len(filename(fileText)) = ? Then
Do not change entry
Else
Overwrite the new detail

View 2 Replies View Related

Prevent User From Skipping Records In Continuous Form During Data Entry

Nov 21, 2006

I have a main form with several continuous subforms. Each subform consists of several listbox controls. I would like to require the user to select an item from the listbox before being allowed to move to the next record in the subform, and upon reaching the last record in that continuous subform, to require an entry there in order to move to the first record in the next cont. subform.

As an added bonus, it would be nice, though not necessary, to automatically jump the focus from one record to the next after data is entered. But my basic goal is to avoid skipping records.

Caveat: I cannot use the "required" option in the field to which the control is bound because that field has a default value previously entered using an append query. (The default value basically means "not yet entered" and is not one of the options in the listbox. I am using this because this field is a foreign key in the table, thus it must have a value in order to have a record with which to populate the subform.)

My apologies if this has been asked and answered elsewhere, but I've searched and, while I found a few related threads, they don't quite answer my question. Here they are for reference:

http://www.access-programmers.co.uk/forums/showthread.php?t=38364
http://www.access-programmers.co.uk/forums/showthread.php?t=69047
http://www.access-programmers.co.uk/forums/showthread.php?t=103176

Thanks for any help! Also, if you are going to recommend VB code, could you be specific about how and where I should use it? I'm not afraid of code, but I'm definitely new to it...

View 7 Replies View Related

Forms :: Prevent Bound Form From Updating Records Before Clicking On Save Button

Oct 31, 2014

I am working on a web database with a form which is bound to an underlying web table where the submissions occur.My challenge is that the fields on the form get submitted to the table even before the submit button is clicked regardless of whether the form was completely filled.

My request is that I want the form to only submit to the submission table only when the submit button is clicked.When I searched on the net, the only solutions I got are VBA written code but my web database cannot use VBA code.

VBA code:

Option Compare Database
Option Explicit
Private blnGood As Boolean
Private Sub cmdSave_Click()
blnGood = True
Call DoCmd.RunCommand(acCmdSaveRecord)
blnGood = False
End Sub

[code]....

View 1 Replies View Related

How To Prevent Corruptions

Jul 21, 2005

I managed to corrupt a database. I think I did this by accidentally creating a module that had no info in it and was never complied.

The day before, I had made several table additions and had run compact and repair twice at the end of the day and all seemed well until the next time the database was opened. Does this make sense that an empty module caused the corruption? I'm asking so that I know how to avoid future mishaps. I'm using Access 2000. Is 2003 less likely to corrupt?

The database was running from my hard drive at the time, so it wouldn't have been a sharing violation.

I think I'll be able to get everything back by importing the objects into a new db.

Thanks,
Mary

View 1 Replies View Related

How To Prevent Tampering

Aug 13, 2007

I am doing more and more Access projects at work. I am using Access 2003. Is there a way I can prevent people from tampering with what I give them? I always create an autoexec macro and run "Windows Hide", then open the main form. Someone can easily unhide the window or hold down the shift key while opening the file, then tamper with what I have put together. Is there an simple and easy way I can prevent tampering?

Thanks,
Jim

View 5 Replies View Related

Prevent Changes On Log Once Saved

Oct 30, 2006

I am a school nurse. I have started to keep a record of office visits of all the kids that come to my office in a MS Access database. I have a table that I use for logging in each student, time, date, reason for visit, action taken, etc. along with a lot of other info on other tables and queries. I'm wondering how to keep the data entered on the health office log from being altered once entered. Is there a way to do this in Access? Thanks

View 7 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved