473,573 Members | 3,343 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 18456
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******@pcdata sheet.com
www.pcdatasheet.com
"ndn_24_7" <nd******@yahoo .com> wrote in message
news:11******** *************@c 13g2000cwb.goog legroups.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!NameOfTextBo x = DMax("[NameOfAutoNumbe rField]","NameOfYourTa ble") + 1
Else
Me!NameOfTextBo x = Me!NameOfAutoNu mberTextBox
End If

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdata sheet.com
www.pcdatasheet.com
"ndn_24_7" <nd******@yahoo .com> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.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.goo glegroups.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******** *************@c 13g2000cwb.goog legroups.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
1222
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 up in the task bar. Is there anyway that I can prevent the second window button from showing up? I don't want to make the form a mdichild form to...
2
1983
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 the tooltip popping out from under the form. On the other buttons they aren't visible. This problem comes and goes. Any ideas on how to fix...
3
2602
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 frm_nc_code As New frm_nc_sen frm_nc_code.Show( Well what I want to have happen is it loads the form then shows all of the controls on the form (especially...
2
1325
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
1211
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 = Frm1
4
3675
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 MessageBox that is located in the main function. This cause compile error because you are not allowed to use this in a static function.
2
2881
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 buttons in a groupbox, and have the appearence set to button
6
1741
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 articles from a database, and like to show a progress dialog while this is happening, just like Outlook's emptying deleted items dialog. However,...
7
1952
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, and I have implemented single instance so that when another instance is run, an event gets signalled in the 1st instance, and what I would like to do...
1
3520
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!! <script type="text/javascript"> /* <! ]> */ </script>
0
7957
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8155
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6337
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5524
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5248
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3685
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3673
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2138
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
975
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.