472,371 Members | 1,587 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,371 software developers and data experts.

Showing the Autonumber on a form

Hello all,

I'm designing a incident reporting program that allows our security
department to record incidents. The problem i'm having is on a form,
when ever a user is going to add a new incident, the user will click a
new records button (which I created using a wizard). I need the
autonumber to appear automatically when ever the new record button is
clicked to add a new record. I do realize that I shouldnt use the
autonumber as a reference, but I didnt know this until I was almost
done with the project. Is their a way to do this ?

Nov 13 '05 #1
5 18344
If your autonumber is in the recordsource, all you need to do is add a
textbox to your form and set its control source to the autonumber field.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com
"ndn_24_7" <nd******@yahoo.com> wrote in message
news:11*********************@c13g2000cwb.googlegro ups.com...
Hello all,

I'm designing a incident reporting program that allows our security
department to record incidents. The problem i'm having is on a form,
when ever a user is going to add a new incident, the user will click a
new records button (which I created using a wizard). I need the
autonumber to appear automatically when ever the new record button is
clicked to add a new record. I do realize that I shouldnt use the
autonumber as a reference, but I didnt know this until I was almost
done with the project. Is their a way to do this ?

Nov 13 '05 #2
Tried to do this, number still not coming up when new record is
pressed. ANy other advice

Nov 13 '05 #3
The autonumber is not assigned in a new record until you make an entry in
one of the fields on the form. You can "anticipate" the autonumber by adding
an unbound textbox (not autonumber textbox) to the form and putting the
following code in the Form's OnCurrent event:
If Me.NewRecord Then
Me!NameOfTextBox = DMax("[NameOfAutoNumberField]","NameOfYourTable") + 1
Else
Me!NameOfTextBox = Me!NameOfAutoNumberTextBox
End If

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com
"ndn_24_7" <nd******@yahoo.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
Tried to do this, number still not coming up when new record is
pressed. ANy other advice

Nov 13 '05 #4
"ndn_24_7" <nd******@yahoo.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
Tried to do this, number still not coming up when new record is
pressed. ANy other advice


Since you used the wizard to write the code, I guess the instruction is
"take me to a new blank record". If this is the case and the code works,
you will simply see a new blank form. The autonumber will not get allocated
until you start to fill in the form. So one possible solution is to write
code to start to fill in the form, e.g. Me.txtDate = Date so today's date is
filled in, the form becomes "dirty" and the autonumber is allocated.
However, although you have an autonumber allocated, the user may not fill in
a required field, so the record does not get saved and that autonumber gets
lost forever. There could be other solutions - it depends how much coding
you want/are able to do.
Nov 13 '05 #5
You are already experiencing one of the problems of making the content of an
Autonumber field visible to a human. If you press on to make use of the
autonumber in this way and build on it you'll probably work yourself into
greater problems. You're better to restrict use of the autonumber datatype
to its intended purpose: the generation of unique keys.

If you need to show your users a sequential key, generate and manage it
yourself. Be aware that, in time. your autonumber field may generate
numbers with broken sequence.

HTH
--
-Larry-
--

"ndn_24_7" <nd******@yahoo.com> wrote in message
news:11*********************@c13g2000cwb.googlegro ups.com...
Hello all,

I'm designing a incident reporting program that allows our security
department to record incidents. The problem i'm having is on a form,
when ever a user is going to add a new incident, the user will click a
new records button (which I created using a wizard). I need the
autonumber to appear automatically when ever the new record button is
clicked to add a new record. I do realize that I shouldnt use the
autonumber as a reference, but I didnt know this until I was almost
done with the project. Is their a way to do this ?

Nov 13 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Terrance | last post by:
Good Morning: I'm hoping someone can help me with a problem that I have. I have one form that is a MdiParent; when I open up another form using the ShowDialog() method a second window button shows...
2
by: Billy Greening | last post by:
Hi, I have attached tooltips to some buttons on my toolbar, but the tooltips at some times are showing up behind the form. When I hover over the button on the far right of my toolbar, I can see...
3
by: Holmes | last post by:
Hello Ran into a bit of a problem here and have now exhausted my resources to getting this working What I am trying to do is load and show a simple vb form with a listbox in it Dim...
2
by: Ant | last post by:
Hi, this is a simple question. i want to click a button to show a form. If I use this code: button_click() { MyNewForm myNewForm = new MyNewForm; myNewForm.Show(); }
5
by: Jerry Spence1 | last post by:
I have the following which generates MDI forms, but doesn't show them at this stage: For n As Integer = 1 To 10 fmViewer(n) = New frmViewer fmViewer(n).Tag = n fmViewer(n).MdiParent =...
4
by: TonyJ | last post by:
Hello! I have a small program that just copy a file and make some checks in main then I just want to inform the user about something by using a MessageBox. I tried to use this in the...
2
by: Peted | last post by:
Hi Im using c# express edition 2005 I have an MDI form, where i load multiple child forms from a dll i create, using reflection and late binding The child forms have multiple radio...
6
Logan1337
by: Logan1337 | last post by:
It almost seems as though Microsoft wants it to be illegal to show a form after the user chooses Application.Exit, yet that is exactly what I need to do. I have a cleanup routine that deletes old...
7
by: =?Utf-8?B?TWF0dA==?= | last post by:
Hi I have an app that runs without a main form, just a notification icon, when the user clicks the icon the form is shown, and when the form is minimized it's hidden. This all works great,...
1
by: ANB8503 | last post by:
Hello, I have created the below script; however, it's not showing in the box like it should... Help please!! I am running out of time to submit this assignment! Thanks in advance!! ...
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
2
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.