Subform New Record (1 Viewer)

Joye

Registered User.
Local time
Today, 03:44
Joined
Aug 3, 2001
Messages
34
I hope this will be an easy question. I have a form which is capturing information about a site visit. Within that is a subform which is linked to a sales table. The main form is a ONE table and the subform is the MANY table. As each property only has one visit a year, but could have many different sales throughout. There is no need for people to look at past sales, just add new sale data.

I would really like the subform to just be blank, ready to add new records. Instead it is showing the already entered records. I know I can add a button to add new record, but I would really just like to have set up to just be ready to add new record.

Thoughts, ideas, solutions.

Thanks.
 

Joye

Registered User.
Local time
Today, 03:44
Joined
Aug 3, 2001
Messages
34
That does not seem to work. I am still seeing the past sales.

You know how when you add a new button, to open a form. It asks you if you want to open the form in edit, or in add. Exactly. I want the same thing with my subform. I want it to view in ADD, not in edit.

Thanks.
 

Fear Naught

Kevin
Local time
Today, 03:44
Joined
Mar 2, 2006
Messages
229
Try adding the following to the on load event of the subform

Docmd.GoToRecord,,acNewRec
 

RuralGuy

AWF VIP
Local time
Yesterday, 20:44
Joined
Jul 2, 2005
Messages
13,826
In the properties of the form you are displaying as a SubForm, do you have [Allow Additions] = Yes and [Data Entry] = Yes? I just tried it and all I see is a new record! What version of Access are you using?
 

Joye

Registered User.
Local time
Today, 03:44
Joined
Aug 3, 2001
Messages
34
I have "Allow Additions" set to Yes and Data Entry as yes and I added the code which was suggested above, for Add New record. Still it is not working.

I don't have the subform and the main form linked, there is no Master/Child Link. So, why when I call up a record which I know has sale information the fields show up with all the past sale data, and not just a blank, new record.

I am working in Access 2002-2003 Format.
 

RuralGuy

AWF VIP
Local time
Yesterday, 20:44
Joined
Jul 2, 2005
Messages
13,826
Is there a chance you could post your zipped up db with any sensitive data removed? You need to leave enough sample data to demonstrate the problem.
 

dbprogman

Registered User.
Local time
Today, 12:44
Joined
Mar 29, 2005
Messages
35
AddNew

Create a macro using GoToRecord command choosing new obviously save the macro and then on the subforms on open event choose your macro. This force the the subform to a new record everytime your form opens.
You could also use VBA to execute your macro by setting the on open event to event procedure and add the following code line,

docmd.runmacro "Your macro name"

Leave inverted commas around your macro name.

I hope this helps

dbprogman
 

ansentry

Access amateur
Local time
Today, 12:44
Joined
Jun 1, 2003
Messages
995
I have to agree with RuralGuy;
Set DataEntry = Yes on the SubForm.

I have attached a sample with Main form and Subform (no Child/Master links)

Open the form frmSubinfo and go to properties and have a look under data at Data Entry = Yes. Thats all I had to change to make it work.

If some how your setup is different then as RuralGuy said post a copy of your database.
 

Attachments

  • SubFormNewRecord.zip
    15.4 KB · Views: 98

Joye

Registered User.
Local time
Today, 03:44
Joined
Aug 3, 2001
Messages
34
These all work great when I do a test run, but as soon as I try to link to the actual data, and create the subforms in exactly they same way, following all the same steps, it does not work.

Guess I will have to find a work around. It just does not make any sense that this is not working.
 

Joye

Registered User.
Local time
Today, 03:44
Joined
Aug 3, 2001
Messages
34
I would have posted the database, but without the real data it works just fine. It is when I try to link to the real data it does not work anymore.

So, I found a work around. I made a copy of my database with links to the tables, create the form and subform, it worked, then I went into my REAL database and imported the table. And it is working fine. No idea why it would not work when I created in within my database.

Thanks for all the help. The Data Entry = Yes, works just great.
 

Users who are viewing this thread

Top Bottom