Another option would be to INSERT INTO tablename (TEXT_columnname) VALUES (‘obscure_reference_code’) to establish the primary key (PK) first.
Then SELECT pk_columnname INTO variable_name FROM tablename WHERE TEXT_columnname = ‘obscure_reference_code’ Then you can “EDIT USING formname WHERE pk_columnname = . variable_name From: rbase-l@googlegroups.com <rbase-l@googlegroups.com> On Behalf Of Doug Hamilton Sent: Thursday, December 8, 2022 9:01 AM To: rbase-l@googlegroups.com Subject: Re: [RBASE-L] - capture autonumber field value whoopsie - NEXT is a bad idea if you just want the autonum value - because it increments the Autonum counter Doug On 12/8/2022 10:56 AM, Doug Hamilton wrote: Dan - two other options might be: 1) If you're trying to get the next autonumber value, the NEXT function: (NEXT(tblname,autonumcol)) Returns the next value of an autonumbered<https://www.rbase.com/support/rsyntax/rbgx5/autonum.html> column. Subtract 1 to get the last assigned number. See: https://www.rbase.com/support/rsyntax/rbgx5/next_functions_3.html 2) MAX function: SELECT MAX(ColumnName) FROM TableName You might need to consider how many users are adding rows to the table to make sure you get the right number. Doug On 12/8/2022 9:45 AM, A. Razzak Memon wrote: Dan, SET VAR vLastValue INTEGER = 0 SELECT colname INTO vLastValue INDIC iv1 FROM tablename WHERE COUNT = INSERT Alternatively, you could also try: SET VAR vLastValue INTEGER = 0 SELECT colname INTO vLastValue INDIC iv1 FROM tablename WHERE COUNT = LAST Hope it helps! Very Best R:egards, Razzak On 12/8/2022 10:34 AM, Dan Goldberg wrote: I am trying to capture an autonumber field value in the after start eep but it keeps showing 0. So I put the variable field on the form so I can watch it(circled red). But when I step thru it I see the variable value in the form but not in the eep. Is there a better way after a form start and when a row is save to get the current autonumber value when those are triggered? TIA [cid:image001.png@01D90AE3.B72576C0] Dan Goldberg -- For group guidelines, visit http://www.rbase.com/support/usersgroup_guidelines.php --- You received this message because you are subscribed to the Google Groups "RBASE-L" group. To unsubscribe from this group and stop receiving emails from it, send an email to rbase-l+unsubscr...@googlegroups.com<mailto:rbase-l+unsubscr...@googlegroups.com>. To view this discussion on the web visit https://groups.google.com/d/msgid/rbase-l/BY3PR19MB5027F39DE5DF0671E6E6873BD41D9%40BY3PR19MB5027.namprd19.prod.outlook.com<https://groups.google.com/d/msgid/rbase-l/BY3PR19MB5027F39DE5DF0671E6E6873BD41D9%40BY3PR19MB5027.namprd19.prod.outlook.com?utm_medium=email&utm_source=footer>. -- For group guidelines, visit http://www.rbase.com/support/usersgroup_guidelines.php --- You received this message because you are subscribed to the Google Groups "RBASE-L" group. To unsubscribe from this group and stop receiving emails from it, send an email to rbase-l+unsubscr...@googlegroups.com<mailto:rbase-l+unsubscr...@googlegroups.com>. To view this discussion on the web visit https://groups.google.com/d/msgid/rbase-l/436f1de3-b28b-42e1-872d-4ba5fec406e8%40rbase.com<https://groups.google.com/d/msgid/rbase-l/436f1de3-b28b-42e1-872d-4ba5fec406e8%40rbase.com?utm_medium=email&utm_source=footer>. ________________________________ [Avast logo]<https://www.avast.com/antivirus> This email has been checked for viruses by Avast antivirus software. www.avast.com<https://www.avast.com/antivirus> -- For group guidelines, visit http://www.rbase.com/support/usersgroup_guidelines.php --- You received this message because you are subscribed to the Google Groups "RBASE-L" group. To unsubscribe from this group and stop receiving emails from it, send an email to rbase-l+unsubscr...@googlegroups.com<mailto:rbase-l+unsubscr...@googlegroups.com>. To view this discussion on the web visit https://groups.google.com/d/msgid/rbase-l/c025e046-ce92-0cf8-b9f1-2dc21e4c3489%40wi.rr.com<https://groups.google.com/d/msgid/rbase-l/c025e046-ce92-0cf8-b9f1-2dc21e4c3489%40wi.rr.com?utm_medium=email&utm_source=footer>. -- For group guidelines, visit http://www.rbase.com/support/usersgroup_guidelines.php --- You received this message because you are subscribed to the Google Groups "RBASE-L" group. To unsubscribe from this group and stop receiving emails from it, send an email to rbase-l+unsubscr...@googlegroups.com<mailto:rbase-l+unsubscr...@googlegroups.com>. To view this discussion on the web visit https://groups.google.com/d/msgid/rbase-l/812fc3be-0dbf-5e17-1c6a-06a41658d1a4%40wi.rr.com<https://groups.google.com/d/msgid/rbase-l/812fc3be-0dbf-5e17-1c6a-06a41658d1a4%40wi.rr.com?utm_medium=email&utm_source=footer>. -- For group guidelines, visit http://www.rbase.com/support/usersgroup_guidelines.php --- You received this message because you are subscribed to the Google Groups "RBASE-L" group. To unsubscribe from this group and stop receiving emails from it, send an email to rbase-l+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/rbase-l/BYAPR03MB371879136A57A16DB60E068E891D9%40BYAPR03MB3718.namprd03.prod.outlook.com.