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 14th, 2006, 04:07 AM
Friend of Wrox
 
Join Date: Jun 2005
Posts: 181
Thanks: 0
Thanked 0 Times in 0 Posts
Default problem with Auto Number

Hi All
I have a form and a sub form.On the sub form is an auto number that generates a new number for each new record.The problem I have is that when I select a new record in the form and and then select something in the sub form the auto number is generated but if I then select something in the form the auto number generates again.Is there any way to stop this happening.
Thanks

Brendan Bartley
__________________
Brendan Bartley
 
Old August 14th, 2006, 08:55 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 217
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi Brendan,
Do I understand this? When you click on the Form after creating a new record in it's subform, the Subform adds a new record? Or the Form adds a new record? Are you using the mouse or the tab key?

LOralee

 
Old August 14th, 2006, 08:58 AM
Friend of Wrox
 
Join Date: Jun 2005
Posts: 181
Thanks: 0
Thanked 0 Times in 0 Posts
Default

when I click on the sub Form a new record is created but when I select from a combo box on the main form again it creates a new record
Thanks

Brendan Bartley
 
Old August 14th, 2006, 09:19 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 217
Thanks: 0
Thanked 1 Time in 1 Post
Default

Brendan,
What is the code behind the combo click event?

Are you scrolling your mousewheel AT ALL?

Loralee

 
Old August 14th, 2006, 09:32 AM
Friend of Wrox
 
Join Date: Jun 2005
Posts: 181
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The mouse wheel is disabled
the following code is behind the combo box
Private Sub Combo11_AfterUpdate()
    Dim svalue As String



    Dim rs As Object

    Set rs = Me.Recordset.Clone

    rs.FindFirst "[CUSTID_HDW] = " & """" & Me![Combo11] & """"
    If Not rs.EOF Then Me.Bookmark = rs.Bookmark

Brendan Bartley
 
Old August 14th, 2006, 09:53 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 217
Thanks: 0
Thanked 1 Time in 1 Post
Default

What data type is CUSTID_HDW?

where do you use sValue?

 
Old August 14th, 2006, 10:13 AM
Friend of Wrox
 
Join Date: Jun 2005
Posts: 181
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Please ignore svalue
The data type is text

Brendan Bartley





Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto Number query again Brendan Bartley Access 4 August 26th, 2006 06:09 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.