Source language: Translate to:

Toggle code

Questions and information about using VBScript and JavaScript in NeoBook functions

Moderator: Neosoft Support

Toggle code

Postby BRobinsonS » Sat Mar 30, 2013 7:46 am

I am using a Checkbox to toggle Active or not Active in a membership database (NeoBookDB Pro).
It seems to have been working, but I want to make sure.
This is the code I have now. I want to make sure the results of the click shows (and database change happens).
CBActive is the Object Name (checkbox).
Code: Select all
If "[AddrBook.Contacts.ActiveStatus]" "=" "True"
  SetVar "[AddrBook.Contacts.ActiveStatus]" "False"
  if "[CBActiver]" "<>" "Checked"
  SetVar "[CBActive]" ""
Else
  SetVar "[AddrBook.Contacts.ActiveStatus]" "True"
  SetVar "[CBActive]" ""
EndIf
dbpSaveEdits "AddrBook" "Contacts"
Brian Robinson
'When all else fails, try again!'
www.ComputerSoftwareSystems.com
User avatar
BRobinsonS
 
Posts: 340
Joined: Sun Sep 25, 2005 9:00 pm
Location: Ontario, Canada

Re: Toggle code

Postby Wrangler » Sat Mar 30, 2013 7:59 am

I see 2 'ifs' but only 1 endif. Each if must have an endif.
Wrangler
--------------
"You never know about a woman. Whether she'll laugh, cry or go for a gun." - Louis L'Amour

Windows 7 Ultimate SP1 64bit
16GB Ram
Asus GTX 950 OC Strix
Software made with NeoBook
http://highdesertsoftware.com
User avatar
Wrangler
 
Posts: 1507
Joined: Thu Mar 31, 2005 11:40 pm
Location: USA

Re: Toggle code

Postby BRobinsonS » Sat Mar 30, 2013 3:42 pm

Didn't notice the Endif missing.
Guess I am going to 'backup' the project before I add the Endif.
Just to be safe. Like I said it seems to have worked to this point.
Brian Robinson
'When all else fails, try again!'
www.ComputerSoftwareSystems.com
User avatar
BRobinsonS
 
Posts: 340
Joined: Sun Sep 25, 2005 9:00 pm
Location: Ontario, Canada

Re: Toggle code

Postby BRobinsonS » Sat Mar 30, 2013 5:18 pm

My original thoughts about toggling a Checkbox to update a Boolean Field in database field seemed to be overdone.

My confusion came with Checkbox status: checked, or "" and Boolean field True or False.
I guess they work together as long as I assign the database field variable to capture the check box status which is true if checked and false if "".

I have tested and simplified the code and seems to work proper.
Brian Robinson
'When all else fails, try again!'
www.ComputerSoftwareSystems.com
User avatar
BRobinsonS
 
Posts: 340
Joined: Sun Sep 25, 2005 9:00 pm
Location: Ontario, Canada


Return to NeoBook Functions - VBScript & JavaScript

Who is online

Users browsing this forum: No registered users and 1 guest