Storing a Value in DB and want to use it to set a Bool Value

Hi All,

I have a bit of code on action that sets a value in a database as a Y or a N if the checkbox is True / False.

I have done a bit of googling but cannot seem to find the answer

What would i need to do to get checkbox to be set as active when app is next loaded using a DB string…

Ive tried:

[code]

Dim DBRecordCall as new DatabaseRecord  // This is calling the Databse
Dim sqlload as String  // This is setting the SQL Code Needed to bring back data from the saved table

sqlload = "select COLUMNNAME from TABLENAME"  // Calling a Single Column From a Table

Dim DatabaseRecordSet as RecordSet = MYDB.SQLSelect(sqlload) // This is running the SQL

While Not DatabaseRecordSet.EOF
  
  if DatabaseRecordSet.Field("COLUMNNAME") = "Y" then DesktopCheckBox.Value = true
  else
    DesktopCheckBox.Value = False
  end if
  

  DatabaseRecordSet.MoveNext
  
wend

DatabaseRecordSet.Close[/code]

Also Tried

Dim DBRecordCall as new DatabaseRecord  // This is calling the Databse
    Dim sqlload as String  // This is setting the SQL Code Needed to bring back data from the saved table
    
    sqlload = "select COLUMNNAME from TABLENAME"  // Calling a Single Column From a Table
    
    Dim DatabaseRecordSet as RecordSet = MYDB.SQLSelect(sqlload) // This is running the SQL

    While Not DatabaseRecordSet.EOF
      
 
       Dim rtn1 as string
      rtn1 = DatabaseRecordSet.Field("COLUMNNAME").StringValue
      
      if rtn1 = "Y" then DesktopCheckBox.Enabled = True   // Y being the TRUE VALUE Stored in DB
      
    wend
    
    DatabaseRecordSet.Close

TIme for me to go to bed!!!

Serious Error on my part. its VALUE not ENABLED!!!

All Working

There are more errors.

You are walking on various records and setting the SAME control? ( .Value = true, true, false, false, false, true… )

Your second code can be an infinite loop without the moveNext()