On Oct 02, 2006, at 6:37 PM, <[EMAIL PROTECTED]>
<[EMAIL PROTECTED]> wrote:
Hello all,
It's been some time since I was last on here. I have a question as
to how to limit the records entered into a RealBasicSQLDatabase?
Here is what I have so far. I added the [ elseif rs.RecordCount >
1 then ] to the code below as the rest works ok.
dim rs as RecordSet
// Select the Maximum Value of the LineItemID column in the
LineItems Table
rs = App.PatientDB.SQLSelect("SELECT MAX(LineItemID) FROM
Medications")
// If there aren't any rows in the table, just return 1 as the
first value to use
if rs = nil or rs.EOF then
return 1
elseif rs.RecordCount > 1 then
MsgBox"This version is limited to only 1 entry."
return 0
end if
// Return the Integer one greater than the maximum for the new ID
return rs.IdxField(1).IntegerValue + 1
Any help?
your query will only return 1 row
if you had done something like
select id, MAX(LineItemID) FROM Medications group by id
you'd get 1 row per ID
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>