TOPIC: Newbie confusion
#1097
Newbie confusion 2 Years, 6 Months ago
Hello, board! :)
I've got some confusion about how to set up primary keys in Suneido. I want to have an integer autoincrementing key, but I can't see anything in the database language that governs that. Am I missing something?
Help, please?

Jon
 
 
#1098
Error in Access 2 Years, 6 Months ago
OK, I think I've worked out how to do an autoincrement, but now I'm getting some other weird errors. Going back to jferguson's post here, I've created a table with a single column that would represent the next number to be used. The code for the rule definition is:
Code:


function ()
{
return GetNextNum("bkcat_nextnum", "nextnum"');
}


The table definition, from Schema View, is:
Code:


bkcat_nextnum
    (nextnum)
    key ()


But now I'm getting the weird error shown in the attached image. Should I have put in an additional column, or is there something else I'm missing?
 
 
Last Edit: 2008/02/20 17:40 By sunadmin.
 
#1100
Error in Access fixed 2 Years, 6 Months ago
OK, figured out that part. In order to make GetNextNum work, I needed to run GetNextNum.Create(), to have the nextnum table generated with the correct columns. I dropped the table I had created and ran this from the Workspace:
Code:


GetNextNum.Create("bkcat_nextnum"')


Next time I pulled up my access window, no errors at all! :)
 
 
#1102
Re:Error in Access fixed 2 Years, 6 Months ago
Glad to hear you got it working. There are two functions for handling auto-increment fields, GetNextNum and GetNextNumber. GetNextNum is more complex and handles unused numbers better and also requires additional fields in the nextnum table (which you already figured out).
 
 
Jeff Ferguson
Suneido Software
 
#1103
Re:Error in Access fixed 2 Years, 6 Months ago
jferguson wrote:
Glad to hear you got it working. There are two functions for handling auto-increment fields, GetNextNum and GetNextNumber. GetNextNum is more complex and handles unused numbers better and also requires additional fields in the nextnum table (which you already figured out).
Thanks. I was able to work this one out on my own, but this other issue that I had posted about is eluding me. Would you be able to take a look at that one, please?
 
 
Last Edit: 2008/02/20 17:33 By sunadmin. Reason: update forum link