Wrox Programmer Forums
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 22nd, 2006, 10:58 AM
Friend of Wrox
 
Join Date: Jun 2005
Posts: 181
Thanks: 0
Thanked 0 Times in 0 Posts
Default Auto Number query again

Hi All again
I have set up my main form customer details and my sub form auto number and other details
When I have logged details against a customer I want to click a command button and clear the details and save the record
When I try to do this I get a error message with the auto number what can I do to stop this.
Thanks

Brendan Bartley
__________________
Brendan Bartley
 
Old August 22nd, 2006, 11:51 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

I don't know what you mean by "clear the details and save the record."

Normally you have a main form and sub form, and the subform keeps records related to the main form record.

It sounds like you want to add records to the sub form related to the main form, then click a button which clears the data entry you just did, and then saves the data somewhere else. Is this correct? If so, why?

The autonumber field error in this case would be because you are taking a number from one table/field (on your sub form?) and trying to push it into another table's autonumber field. You can't do this. auto means auto. If you want to save the auto number generated in the first sub form, change the autonumber field in the second table to Number (integer).

Does this help?


mmcdonal
 
Old August 22nd, 2006, 11:56 AM
Friend of Wrox
 
Join Date: Jun 2005
Posts: 181
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for you're reply
No there is only one auto number in the sub form.
I want to insert a submit button that clears all the records from the sub form
this includes the auto number
Thanks

Brendan Bartley
 
Old August 22nd, 2006, 11:59 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

I am not sure why you are clearing records from a subform. What is the table that the form is built on?

I would take the PK (autonumber) field in a variable, then do

DELETE FROM tblYourSubFormTable WHERE [PK] = PKfromSubForm

Don't delete it from the sub form, delete it from the underlying table.

Does this help?

mmcdonal
 
Old August 26th, 2006, 06:09 AM
Authorized User
 
Join Date: May 2006
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hello, sir
I have a field naming Diary_number it is autonumber, it start from 1 but i want to start my diary number from 1401, is it possible or not, if it is possible then please help me and tell me how







Similar Threads
Thread Thread Starter Forum Replies Last Post
problem with Auto Number Brendan Bartley Access 6 August 14th, 2006 10:13 AM
auto generate an number utarian Access 2 March 28th, 2005 02:24 AM
[b]Auto Number[/b] vanjamier Classic ASP Databases 1 November 18th, 2004 03:44 AM
Auto number yami56 Access 1 August 20th, 2004 11:24 AM
Auto number Sheri Dreamweaver (all versions) 0 December 22nd, 2003 03:36 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.