
Quote from CSSystems on October 25, 2021, 6:42 pmInputBox "Check Member Number" "Look FOR Duplicates" "[FoundNumber]" If "[FoundNumber]" ">" "" dbpQuery "ARMDB" "Members" "OSSTF = [#34][FoundNumber][#34]" If "[ARMDB.Members.$RecCount]" "=" "0" AlertBox "Ok" "No duplicates were found." dbpShowAll "ARMDB" "Members" dbpAddRecord "ARMDB" "Members" SetVar "[ARMDB.Members.OSSTF]" "[FoundNumber]" FocusObject "LASTNAME" Else AlertBox "Duplicate Number" "Member Number [FoundNumber] already exists." dbpShowAll "ARMDB" "Members" dbpSort "ARMDB" "Members" "LASTNAME=ASC;FIRSTNAME=ASC" EndIf ELSE AlertBox "Search Number" "Member Number field is Blank.|Aborted !" ENDIFI use similar routine in another program without this problem.
This routine inserts a blank record in the database and well as allowing me to create record which I can edit / add to.
I have looked and looked at the code and tried modifications.
Can some one see the flaw?
InputBox "Check Member Number" "Look FOR Duplicates" "[FoundNumber]"
If "[FoundNumber]" ">" ""
dbpQuery "ARMDB" "Members" "OSSTF = [#34][FoundNumber][#34]"
If "[ARMDB.Members.$RecCount]" "=" "0"
AlertBox "Ok" "No duplicates were found."
dbpShowAll "ARMDB" "Members"
dbpAddRecord "ARMDB" "Members"
SetVar "[ARMDB.Members.OSSTF]" "[FoundNumber]"
FocusObject "LASTNAME"
Else
AlertBox "Duplicate Number" "Member Number [FoundNumber] already exists."
dbpShowAll "ARMDB" "Members"
dbpSort "ARMDB" "Members" "LASTNAME=ASC;FIRSTNAME=ASC"
EndIf
ELSE
AlertBox "Search Number" "Member Number field is Blank.|Aborted !"
ENDIF
I use similar routine in another program without this problem.
This routine inserts a blank record in the database and well as allowing me to create record which I can edit / add to.
I have looked and looked at the code and tried modifications.
Can some one see the flaw?


Quote from AsleyCruz on October 26, 2021, 12:00 amHi, @cssystems
The action dbpAddRecord adds a new EMPTY record to a table (see help). To save the data into the record, you must use the action dbpSaveEdits at the end, but if you don't want it to "insert a blank record", just delete the action dbpAddRecord.
The action dbpSetAutoEdit (option: Yes) will save automatically the changes of the record while you are typing at any text entry linked to the database.
Regards.
dbpAddRecord "ARMDB" "Members"SetVar "[ARMDB.Members.OSSTF]" "[FoundNumber]"dbpSaveEdits "ARMDB" "Members"
Hi, @cssystems
The action dbpAddRecord adds a new EMPTY record to a table (see help). To save the data into the record, you must use the action dbpSaveEdits at the end, but if you don't want it to "insert a blank record", just delete the action dbpAddRecord.
The action dbpSetAutoEdit (option: Yes) will save automatically the changes of the record while you are typing at any text entry linked to the database.
Regards.
dbpAddRecord "ARMDB" "Members"SetVar "[ARMDB.Members.OSSTF]" "[FoundNumber]"dbpSaveEdits "ARMDB" "Members"

Quote from CSSystems on October 26, 2021, 3:04 pmInteresting that the dbpShowAll below creates the Blank record so if I leave out the dbpAddRecord it allows me to complete the fields of the record I am trying to add. Not sure why it works this way, but it works for me. As I said I have a similar program where the original routine works. That's why it is baffling.
If "[ARMDB.Members.$RecCount]" "=" "0" AlertBox "Ok" "No duplicates were found." dbpShowAll "ARMDB" "Members" dbpAddRecord "ARMDB" "Members"
Interesting that the dbpShowAll below creates the Blank record so if I leave out the dbpAddRecord it allows me to complete the fields of the record I am trying to add. Not sure why it works this way, but it works for me. As I said I have a similar program where the original routine works. That's why it is baffling.
If "[ARMDB.Members.$RecCount]" "=" "0"
AlertBox "Ok" "No duplicates were found."
dbpShowAll "ARMDB" "Members"
dbpAddRecord "ARMDB" "Members"