Blank Record Created When Closing Form

I have a statistical program and the user constantly use the form to check calculations and get out without saving a record. In order to allow this with out writing to the table I used unbound fields and an accept and close command buttons.

This worked well until I added a subform to one of the forms. Now, if I just open that form and then click the close button, I get a blank record in the table associated to the main form. Is there a way to stop this?

View Replies


Open Form With Last Record Created From SQL - Version: 2003 (11.0)

I have an unbound form that contains basic project data. A command button triggers the creation of a new record with the information entered (Code below)

I want to be able to open the newly created record in a different form so that the user can review/edit/add to the basic information.

How can I get the new record ID and use it to open the record in my edit form?

Thanks for your help

Code:If IsNull([ProjName]) Or IsNull([RequestorArea]) Or IsNull([Requestor]) Or IsNull([ProjType]) Or IsNull([cboChampion]) Or IsNull([ProjStatus]) Or IsNull([ProjLocation]) Or IsNull([RespArea]) Or IsNull([RespPerson]) Or IsNull([ProjRole]) Then

MsgBox "Please fill in all required fields"


Dim rst As DAO.Recordset

'Open targeted recordset
Set rst = CurrentDb.OpenRecordset("SELECT * FROM tblProject WHERE 1=0", 2, dbAppendOnly)

'Save the entries in the controls back to a recordset record
With rst
!ProjName = Me.ProjName
!ProjStartDate = Me.dtProjStartDate
!ProjOpenDate = Me.dtProjOpenDate
!ProjCloseDate = Me.dtProjCloseDate
!RequestorArea = Me.RequestorArea
!Requestor = Me.Requestor
!ProjType = Me.ProjType
!Champion = Me.cboChampion
!ProjStatus = Me.ProjStatus
!ProjLocation = Me.ProjLocation
!CostCenter = Me.CostCenter
!Recurring = Me.Recurring
!NeedsAttn = Me.NeedsAttn
!ECReview = Me.ECReview
!Confidential = Me.Confidential
!Description = Me.Description
!RespArea = Me.RespArea
!RespPerson = Me.RespPerson
!ProjRole = Me.ProjRole
End With

End If

View Replies View Related

Detect If New Record If Closing Form


I have a form with 55 values entered. On closing the form, I need it to decide if this is a new record. If it is a new record, it loads all 55 values into an array. If all values are above 20,000, it goes ahead and closes the form. If any are below 20,000, it writes the record to another table and brings up that form to add add a comment.

Every thing does as it should except determining if it is a new record. What property will trigger it properly? All the properties I have tried either triggers it on all the records (even if it is an old record) or it does not trigger it and closes without prompting the code.

View Replies View Related

Force A Record To Be Created In Main Form - Version: 2002 (10.0) XP

Hi everybody,

a have a form with many subforms. The main form contains only a little data (case ID, date of creation, username) and all this can be automatically filled in.

However, if I fill in all using default values, a new record is actually not created, or so it seems (the Autonumber control does not show a number etc.). The followup problem is, that when the user happily moves on from these pre-filled controls to one of the subforms, she gets an error message "The field tblPatients.CaseID cannot contain a Null value because the Required property for this field is set to True. Enter a value in this field." How do I force a record to be created in the main form and still use pre-filled controls?

- garcanrya

View Replies View Related

Closing A Form Without Saving A Record - Version: 2000 (9.0)

Hi all. I'm calling a employment history form "Employment" out of another form "Employee_Data". I have written it so the Employee_Data field in the Employment form is automatically filled in when you click the update button off the Employee_Data form. This is because I want to keep track of historic employment aswell - not just current employment. So I have a line in the employment table for every time you enter an employee with their name, client and the date they started. By filling in the name field however, I create a new record along with it. This is all fine and dandy untill you accidentally press the update button on the "employee_data"and load the "Employment" form. This will cause a line in the table with employee name and the rest of the fields blank when you close the "Employment" form. In an attempt to dummy proof this, I'm trying to build in an if statement when you click the close button on the "Employment" form. If you didn't fill in the client, don't save the record. If you did, save the record. So this is what I did :

Code: Private Sub ExitButton_Click()
On Error GoTo Err_ExitButton_Click

Dim strClient_Name As Boolean

If Client_Name.Text = "" Then
boolClient_Name = False
boolClient_Name = True
End If

If boolClient_Name = False Then
DoCmd.Close acForm, "Employment", acSaveNo
MsgBox "You have not entered a client. This record will not be saved", vbOKOnly, "Notice"
DoCmd.Close acForm, "Employment", acSaveYes
End If

Exit Sub

MsgBox Err.Description

I just end up saving the record anyway when the form is closed. I'm pretty new on the VB side, so do I just not understand the DoCmd.Close parameters or is there another way to do this ?

Thanks a bunch

View Replies View Related

Need Blank Record On Form

I have a form with a drop down of employee names and a tabbed subform.

I have the form and subform set up to open on a new record and, when the employee name is selected to fill the subform with that employee's data.

It is a split db with the be on the network server and everyone has their own copy of the fe. When I open the front end the combo box is blank but the first page on the tabbed subform shows data. If I close it and reopen it, sometimes its blank and other times it still shows data.

What else do I need to do to ensure that it is a blank record?

Also, I am using the MouseHook.dll and included it in my .exe (zip) file to all of my users, instructing it to download to the same location as the .mdb file (C:/Training Database). Will this work or does the MouseHook.dll need to be somewhere else?



View Replies View Related

Blank Record In A Form

i have a subform as a continuous form, and at the bottom, there is the normal blank record (created automatically), to enter a new record. Is it possible to attach a piece of code to a field but which will be available only to the field of this blank record, rather than being available for the particular field of all the records in this continuous form ?

Basically i want that if the focus is on this blank record, and i will hit the tab key i want to move the focus to a control, on the main form, that's why i want it specifically, when only this blank record at the end has the focus.

Thank you for any suggestions.

View Replies View Related

Open Form To A Blank Record

I have a form that is used to both Enter & Edit records. There is a "search" button to aid in finding records.
I have been asked to have the form open to a blank record instead of the first record in the table.
Is there a way to do this without setting the "DataEntry" property to true, as this basiclly disables the "search" button.


View Replies View Related

Blank Record Upon Opening Form

When the user double clicks on the icon, the form automatically appears on the screen. That's good. But record number 1 is there. I want a blank record there so they can enter their data. This can't be difficult, but I can't figure it out.

View Replies View Related

How To Open Form With Blank Fields Rather Thn First Record!

I have a form linked to an employees table. I have a search function on this form which allows you to search for a particular employee.
At the moment when i open my form, it always displays the first record!
How can I make my form open with blank fields instead of the first record showing?

Thanks alot.


View Replies View Related

Default Blank Record When Opening Form


I have a form which is based on a table.

I was wondering if it is possible that when the form is opened a blank record could be displayed rather than the first entry in the table. In other words, it would be like opening a form and clicking the "Add Record" button, a blank record would be displayed and data entry could take place.

Any thoughts/ideas would be much appreciated.

Thanks in advance

View Replies View Related

Blank New Form Is No Longer Blank?

Hi guys,

I have been running the same database on numerous systems for 5 years and the user clicks on a button and using this code;

DoCmd.OpenForm "Employee", acNormal

Simple !, this always opened this form blank, without applying filters, ready to accept a new employees details.

But now this no longer works, for no apparent reason?
What happens is that it opens with the form fields filled with the first person in the Databases details instead of being blank.

The only thing that could have changed is that i converted the database to 2003?

Any ideas?

Thank you in advance

View Replies View Related

Opening Form To A Blank Record - Version: Any Version

the database opens to a switchboard, on the switchboard I'll choose the FORM, when the form opens, its at the very first record entered. How can I have the foem open to the empty/not filled in record?

View Replies View Related

A Button To Delete A Newly Created Record?

Hokay, firstly my apologies if this is the wrong subforum, but since my question revolves around the behaviour of one of my forms I guessed the thread should go here.

I have a very simple little database which I use to log RMAs (Returned Merchandise Authorizations). The database consists of three forms:

Form A - The switchboard. The main menu, works fine.
Form B - The View/Edit window. Allows me to look at the records in the database and alter them if necessary, works fine.
Form C - The Add window. Has the same form layout as B, but allows for adding records only. This is the one causing problems.

Now the situation is that when I enter Form C, the box for the RMA number gets autofilled out - which is correct - thus creating a new record. However, what I want to achieve is a button on the form that will allow me to quit back to the main menu without saving the record that has been created by opening the form. This is for situations where the form has been accidentally opened, or where a form has been started, but is not required to be finished.

View Replies View Related

Resetting A Mulitple Select List Box When New Record Is Created

I have created a form in access that contains a multiple select list box and a command button "New Record," that creates a new record. I select values in the list box for the current record. When I click on the "New Record" button, the values that I selected in the previous record are still selected. How can I reset the list box so that no values are selected when I create a new record?

View Replies View Related

Subform On Tab Does Not Populate When A Record Is Created - Version: 2007 (12.0)


I have a main form linked to my employee table. on this form, i have a subform (checkInOut) which is linked to the employee table through the PK empID. I have a tab with two subforms (Credits, Purchases) on it. the credits tab is linked to the checkInOut subform via checkoutInID. as i move through the checkins his credits relating to that transaction, change as they are supposed to. The purchase tab is another story. when ever i make an entry to that table, which is also linked to the checkInOut subform via checkoutInID, although the table (purchases) is updated, the form is not. I can not view in form view (navigate through the records in that tab) the purchases for the checkInOuts unless I go to that table and see them. Below is my table structure.

Mainform: Employee Table; empID
Subform: CheckOutIn Table; checkoutInID, empID, prodID
Tab1 Subform: Purchases Table; purchaseID, checkOutInID, quantity, date, amt
Tab2 Subform: Credits Table; creditID, checkOutInID, creditDt, creditPayBackDt, creditPayBackAmt

The part that is not working properly is the the Make purchase tab.

Any help is appreciated. Please Advise.

View Replies View Related

Closing A Record On A Subform

Attached is a really rough db. I used this just as an example.
I have a close button on the subform pndata_frm. I have the button so it closes the record and then moves to the next record. The code used for this works ok if the user closes say record 1 then record 2 in order. But if they skip to say record 10 and close it, and don't close any of the records prior, it jumps back to record 2. Not sure why this is happening. Do I have this wrong? Or is there another way to do this? When you open the form open PNData_tbl. Thanks..
Me.Parent.Bookmark = Me.Parent.RecordsetClone.Bookmark

View Replies View Related

Save Record Without Navigation Or Closing


I have a form with a button and a text box

The control source for the text box is a Number field called FileNo in a Table called File. THe default value of the text box is 0.

When the button is clicked a value is calculated using the last value under FileNo in the Table.

The problem is that I have to either navigate the records or close the form in order to save the new value onto the Table.

I need to be able to save a new value to the Table as soon as it is generated without having to close or navigate. So that I get some new value everytime I click the button without closing the Form.
(when the button is clicked 1 will be added to the last value under FileNo on Table File)


View Replies View Related

Save Record Without Navigation Or Closing


I have a form with a button and a text box

The control source for the text box is a Number field called FileNo in a Table called File. THe default value of the text box is 0.

When the button is clicked a value is calculated using the last value under FileNo in the Table.

The problem is that I have to either navigate the records or close the form in order to save the new value onto the Table.

I need to be able to save a new value to the Table as soon as it is generated without having to close or navigate. So that I get some new value everytime I click the button without closing the Form.
(when the button is clicked 1 will be added to the last value under FileNo on Table File)


View Replies View Related

Save Record Without Navigation Or Closing


I have a form with a button and a text box

The control source for the text box is a Number field called FileNo in a Table called File. THe default value of the text box is 0.

When the button is clicked a value is calculated using the last value under FileNo in the Table.

The problem is that I have to either navigate the records or close the form in order to save the new value onto the Table.

I need to be able to save a new value to the Table as soon as it is generated without having to close or navigate. So that I get some new value everytime I click the button without closing the Form.
(when the button is clicked 1 will be added to the last value under FileNo on Table File)


View Replies View Related

Master Record Not Creating When Detail Is Created From Listbox - Version: 2003 (11.0)

I have a form for creating new quotes for my business. On the form I have combo boxes to select the customer and the salesrep. I also have fields for the Quote ID (autonumber, primary key, display only), the Quote Date and a memo box for Comments.

I have a pair of list boxes. The one on the left (lbSource) lists the Products and Product Options that can be selected for the Quote. The one on the right (lbDestination) is filled when you select a Product or Option and then press the Select button. When you press the Select button (in the On Click), I use an AddNew to create a new record and move the values from the columns in the row selected to fields on my Quote Details record. I also move the QuoteID from the Quote master record to a field on the Quote Details record so the records will have a link. Then I Update the record and it is written to the file.

My problem is that the QuoteID field is null. I put a 'Create New Quote' button on the form that calls a macro which creates a new record and then goes to that record but the value of the QuoteID field on the form is still null. I don't know what else to do.

View Replies View Related

Problem With Closing Record Without Saving - Version: 2002 (10.0) XP

I don't know why this is such a problem today, but:

I have a main form that displays lists of all the contacts in my CRM database

Clicking Add New Contact will open up a Contact Entry form.
However, If the use doesn't enter all the information and exits, I don't want the current record to be saved.

If they select a contact, the Contact Entry form displays with their information in it. THey have the option of clicking Add New Contact to add a new contact for the same company/location.

Right now, I either end up with an extra record when I close the new contact form on an empty record, or I end up deleting the wrong record, if I try to tell it to delete the current record if the required fields are empty.

any ideas what I'm doing wrong? It's probably just some event that I'm not understanding correctly.


View Replies View Related

Unable To Set Focus On New Form On Closing Another Form - Version: 2003 (11.0)

Hi, Does anyone know why the following line of code will not work when I call the following procedure in a module on closing my form.

Public Sub test()

Var2 = 1356

DoCmd.GoToControl "[PrimaryKey]"

DoCmd.FindRecord Var2, acEntire, , acSearchAll, , acCurrent, True

End Sub

It errors at "DoCmd.GoToControl "[PrimaryKey]"" the form with the primary key is always open.

It appears to still be looking at the form that should have closed still.

The code runs fine if I run it from vb.

Any assistance really appreciated, Jim.

View Replies View Related

How To Add Fields To A Table After A Form Has Been Created.

Anybody able to help me with this. I think there should be a simple solution to it, but it eludes me at the moment. Basically, I have created a form in MsAccess with alot of vb script on it, but
now I realise that I have to add more fields to the source table.
If I insert a new unbound text box onto the form, how do i bind it to
the new field in the source table. is there a formula that I should
use? When I look at the dropdown in the control source property, it
only gives me the fields that were in existense at the time the form
was created?

your help appreciated


View Replies View Related

MsgBox Closing Main Form Then The Correct Form?

Hi all,

I've added a message box to what is basically a standard simple to use access control, "closeForm", I'm a newbie working on learning access vb. I'm guessing my code if fudged. Any help is greatly appreciated.

Private Sub Close_Click()
On Error GoTo Err_Close_Click
Dim Answer As Integer
Answer = MsgBox("Press Ok to Close, Cancel to Continue.", vbOKCancel + vbQuestion, "Exit Data Entry?")
If vbOK Then DoCmd.Close

Exit Sub

MsgBox Err.Description
Resume Exit_Close_Click

End Sub

Thanks to all in advance

View Replies View Related

New Blank Record

I've created a form for updating / inputting data to my table. Currently it is defaulting to show the existing data from record 1 of my table. But as the most frequent requirement of the form will be to add a new record to the table, I would like it to default to show a new blank record. Is there a way of doing this? Perhaps some code that I could incorporate against the "on activate" for the form.


View Replies View Related

Can't Save Forms Created By Form Wizard

guys hello
i'm having a very weird problem i'm using access 2003 and when i'm creating a form using the wizard for the forms i can't save him i when i'm pressing the X button i'm getting the dialog to save the form and promted for the form name but it doesn't do anything and the form do not closes , when i'm creating forms by manual this problem doesn't appeares . i'm already (uninstalled and installed ) * 5 office , installed windows again , deleted the office dir , deleted the shared office directory cleaned the registry installed another version of office and no effect . i would appreciate any help thanks.

View Replies View Related

Created Form - Problems With Search And Clear


I have a problem I have been trying to research for weeks and am desperately hoping that someone out there can help me!

I have a form I created and have added automatic text buttons for search entry (filter by selection), search criteria (filter by form), and clear search (removes the filters and sends the form back to record one). The buttons work fine the first time I utilize them, however each subsequent time I hit search it returns with the information that I searched by for the first time. The only way I can get around this is if I close the form and reopen it but that is not practically. My employer wants these buttons and does not want to have to utilize the built in filter buttons. Any ideas?

Also - my clear form is a macro which removes the applied filter and returns to the first entry (which is blank) is there someway I can also make it clear all entrees on this form as well?

If anyone could help I would appreciate it greatly!

View Replies View Related

Closing A Form Vs. Really Closing A Form

This is related to some advice I received some time ago <a href="">here<a>

I am runnign some code, it performs some applications, then, if a Count Field is greater than 1, a form opens as a dialog, displaying some information:

Dim A As String
A = "NewForm"
If Me.[Count] > 0 Then
DoCmd.OpenForm A, acNormal, , , , acDialog
End If
If Me.Continue = "No" Then
Exit Sub

End If

The new form opens, and you can either view it, and click continue, which will run the rest of the code, or you can click quit, which updates Me.Continue to "No", and then it exits.

The problem is, when it exits the Sub, it doesn't really stop the code, it just leaves things kind of hanging. When I try to run the code again, I get:

3321 - The database engine could not lock the table 'NewTable' becuase it is already in use by another person or process.

Another symptom - The original form where I click to start running the code, has two date fields. Normally, when this form opens, they are blank, but when I exit the sub, as above, the previous dates I entered are still sitting there.

How can I make the forms really close?

View Replies View Related

Closing A Form

When a form is open you can also see on the task bar that the form is open
If the user right clicks on the form(on the task bar ) they get the following options minimize , maximise , close.

Does any one know how I can stop the user selecting Close please ?

View Replies View Related

Closing Of Form

when i close the form all the fileds in the forms gets saved to the table.
i want it should pop up before closing to save it or not.
i have a button on the form to save the fields in the table.
which has code

DoCmd.GoToRecord , , acNewRec

View Replies View Related

Blank Record In Subform

I have a main form with many subforms. The sub forms are all continuous but one and I want the editors to be able to put in more then one record if needed.
My problem is I have my tabs set up so that when the box is empty it will tab to the next subform. When I do this, a extra blank record is automatically saved in the subform above. How do I get rid of the blank record?
Thank you in advance for any advice shared.

View Replies View Related

Any Way Of Not Showing The Blank Record?

I've got a text box, populated by a query.
(it looks like a list because it's tabular view)

you can always see the empty record... any way you can stop it showing?

or failing that, I have a dblclick event on all the textboxes. But It doesn't work with the blank record..

this is quite frustrating.. any help please?

View Replies View Related

Copyrights 2005-15, All rights reserved