This is an interesting one.....
I have a field on FORM!FORMDATA (no, I did not name this) called KEY.
There can be multiple KEYS per record (equates to FIELDS on a given
DOCUMENT).
The users want to Add a Key and manually assign the number, say 2.
They do this to retain the order in which fields will print on a
document.
If Keys 2 --- 10 already exist, then Old Key 2 becomes 3, Old Key 3
becomes 4, etc.
Adding a new key is triggered by a button running this code:
Private Sub butAddNew_Click()
On Error GoTo Err_butAddNew_Click
Dim DOCNUMBER As String
Dim SegmentNumber As String
Dim NextKey As Long, Dummy
DOCNUMBER = Form_Number
'DoCmd DoMenuItem 0, 0, 4, 0, A_MENU_VER20 ' Tries to Save
Record
NextKey = GetNextKey(Val(DOCNUMBER))
DoCmd.GoToRecord , , A_NEWREC
Form_Number = DOCNUMBER
'KEY value now on Subform -- aww 8/14/04
Forms![sfrmKeys_AW]![KEY] = NextKey
Forms![sfrmKeys_AW]![KEY].SetFocus
Exit_butAddNew_Click:
Exit Sub
DoCmd.SetWarnings (WarningsOn)
Err_butAddNew_Click:
MsgBox Error$
Resume Exit_butAddNew_Click
End Sub
===
Any idea on how to renumber Keys as described above?
Thanks!
amy
== 2 1249
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I believe it would be better to just set the new key to the last old
key, plus one. E.g.:
key = dmax("key","table_name") + 1
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv
iQA/AwUBQR1lrIechKqOuFEgEQLXfQCgoUa6MYeIbNlEi08KGtUIy6 PJwj8An033
fJEcja0dRSnyTC7MpMwG9WjN
=Xfnl
-----END PGP SIGNATURE-----
amywolfie wrote: This is an interesting one.....
I have a field on FORM!FORMDATA (no, I did not name this) called KEY.
There can be multiple KEYS per record (equates to FIELDS on a given DOCUMENT).
The users want to Add a Key and manually assign the number, say 2. They do this to retain the order in which fields will print on a document.
If Keys 2 --- 10 already exist, then Old Key 2 becomes 3, Old Key 3 becomes 4, etc.
Adding a new key is triggered by a button running this code:
Private Sub butAddNew_Click()
On Error GoTo Err_butAddNew_Click
Dim DOCNUMBER As String Dim SegmentNumber As String Dim NextKey As Long, Dummy
DOCNUMBER = Form_Number 'DoCmd DoMenuItem 0, 0, 4, 0, A_MENU_VER20 ' Tries to Save Record NextKey = GetNextKey(Val(DOCNUMBER)) DoCmd.GoToRecord , , A_NEWREC Form_Number = DOCNUMBER
'KEY value now on Subform -- aww 8/14/04 Forms![sfrmKeys_AW]![KEY] = NextKey Forms![sfrmKeys_AW]![KEY].SetFocus
Exit_butAddNew_Click: Exit Sub
DoCmd.SetWarnings (WarningsOn)
Err_butAddNew_Click: MsgBox Error$ Resume Exit_butAddNew_Click
End Sub ===
Any idea on how to renumber Keys as described above?
Thanks!
amy ==
Unfortunately, that won't work, based on the user requirements.
amy
===
MGFoster <me@privacy.com> wrote in message news:<PA*****************@newsread1.news.pas.earth link.net>... -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
I believe it would be better to just set the new key to the last old key, plus one. E.g.:
key = dmax("key","table_name") + 1
-- MGFoster:::mgf00 <at> earthlink <decimal-point> net Oakland, CA (USA)
-----BEGIN PGP SIGNATURE----- Version: PGP for Personal Privacy 5.0 Charset: noconv
iQA/AwUBQR1lrIechKqOuFEgEQLXfQCgoUa6MYeIbNlEi08KGtUIy6 PJwj8An033 fJEcja0dRSnyTC7MpMwG9WjN =Xfnl -----END PGP SIGNATURE-----
amywolfie wrote: This is an interesting one.....
I have a field on FORM!FORMDATA (no, I did not name this) called KEY.
There can be multiple KEYS per record (equates to FIELDS on a given DOCUMENT).
The users want to Add a Key and manually assign the number, say 2. They do this to retain the order in which fields will print on a document.
If Keys 2 --- 10 already exist, then Old Key 2 becomes 3, Old Key 3 becomes 4, etc.
Adding a new key is triggered by a button running this code:
Private Sub butAddNew_Click()
On Error GoTo Err_butAddNew_Click
Dim DOCNUMBER As String Dim SegmentNumber As String Dim NextKey As Long, Dummy
DOCNUMBER = Form_Number 'DoCmd DoMenuItem 0, 0, 4, 0, A_MENU_VER20 ' Tries to Save Record NextKey = GetNextKey(Val(DOCNUMBER)) DoCmd.GoToRecord , , A_NEWREC Form_Number = DOCNUMBER
'KEY value now on Subform -- aww 8/14/04 Forms![sfrmKeys_AW]![KEY] = NextKey Forms![sfrmKeys_AW]![KEY].SetFocus
Exit_butAddNew_Click: Exit Sub
DoCmd.SetWarnings (WarningsOn)
Err_butAddNew_Click: MsgBox Error$ Resume Exit_butAddNew_Click
End Sub ===
Any idea on how to renumber Keys as described above?
Thanks!
amy == This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Craig Bailey |
last post by:
Anyone recommend a good script editor for Mac OS X?
Just finished a 4-day PHP class in front of a Windows machine, and liked
the editor we used. Don't recall the name, but it gave line numbers as...
|
by: Chris |
last post by:
Sorry to post so much code all at once but I'm banging my head against
the wall trying to get this to work!
Does anyone have any idea where I'm going wrong?
Thanks in advance and sorry again...
|
by: Alan Walkington |
last post by:
Folks:
How can I get an /exec'ed/ process to run in the background on an XP box?
I have a monitor-like process which I am starting as
'exec("something.exe");' and, of course the exec function...
|
by: John Ryan |
last post by:
What PHP code would I use to check if submitted sites to my directory
actually exist?? I want to use something that can return the server
code to me, ie HTTP 300 OK, or whatever. Can I do this with...
|
by: Beowulf |
last post by:
Hi Guru's,
I have a query regarding using PHP to maintain a user profiles list. I
want to be able to have a form where users can fill in their profile
info (Name, hobbies etc) and attach an...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
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,...
|
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...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
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...
| |