Results 1 to 9 of 9

Thread: How to read and write combined data from/to the field

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2009
    Posts
    131

    How to read and write combined data from/to the field

    Hi all,I need to save the properties about 50 controls form in Access 2003 data base, such as length, width and height, distance from the top, distance from the left, font color, background color, etc . And since Access 2003 only has the ability to manage 255 fields for each table. It is not possible to save any of the features in one field. How can I save and read the properties of each control in a field together as separated, such as:

    lbl(1): "120|300|250|500|True|330|False|, ..."
    lbl(2): "90|140|50|310|Fale|100|False|, ..."

    The user can click on any of the controls such as labels, images, etc. to change the size and location of each control.
    My challenge is reading and writing data together and separately.

    I would be grateful if you have a code in this field.

  2. #2
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    6,733

    Re: How to read and write combined data from/to the field

    How do you have more than 255 properties for a single control??

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Aug 2009
    Posts
    131

    Re: How to read and write combined data from/to the field

    Quote Originally Posted by Arnoutdv View Post
    How do you have more than 255 properties for a single control??
    I don't have 255 properties for one control. Each control has about 10 properties, and I have 50 controls, which makes 500 properties for all controls. If I want to put one field for each control in the table, it is not possible because each table in Access 2003 only manages 255 fields.

    If possible, put all 10 features of each control in one field of the table together but separately. Only 50 fields are required.
    The challenge is how to store and read these features from the database
    Last edited by unforgiven747; Aug 30th, 2022 at 03:09 AM.

  4. #4
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    6,733

    Re: How to read and write combined data from/to the field

    Aha, the cross product of all controls with all properties.
    I think a better approach is to have a row per control.
    Create a table with columns for all the unique properties like name, x, y, width, height, backcolor, forecolor etc etc.
    Then create a new entry (row) in the table for each control.

  5. #5
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    5,261

    Re: How to read and write combined data from/to the field

    Urggghhh..... and now i'm going to spice this up by introducing "Parent" to the controls.
    In a nutshell: Use JSON with Json-Objects, JSON-Fields, JSON-Arrays, JSON-ChildObjects etc. etc. blahblahblah and build a hierarchy, and save it as a single String or BLOB
    Last edited by Zvoni; Tomorrow at 31:69 PM.
    ----------------------------------------------------------------------------------------

    One System to rule them all, One Code to find them,
    One IDE to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ---------------------------------------------------------------------------------
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    ---------------------------------------------------------------------------------
    Code is like a joke: If you have to explain it, it's bad

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Aug 2009
    Posts
    131

    Re: How to read and write combined data from/to the field

    Quote Originally Posted by Arnoutdv View Post
    Aha, the cross product of all controls with all properties.
    I think a better approach is to have a row per control.
    Create a table with columns for all the unique properties like name, x, y, width, height, backcolor, forecolor etc etc.
    Then create a new entry (row) in the table for each control.
    In this example, for each control, I considered a column under the name of the control and a column to store its properties. Now the problem is how to read and save the properties of a control that are together?

    lbl(1): "120|300|250|500|True|330|False|, ..."
    lbl(2): "90|140|50|310|Fale|100|False|, ..."

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Aug 2009
    Posts
    131

    Re: How to read and write combined data from/to the field

    I was able to read the arrays with split, but I could not save the arrays in the field.

    Dim Data() As String
    Dim moni As New ADODB.Recordset

    If moni.state = adStateOpen Then
    moni.Close moni.Open ("select * from Moni_Settings "), dB, adOpenKeyset, adLockOptimistic
    Data = Split(Text1, "|") newData = Data(0) & "," & Data(1) & "," & Data(2) & "," & Data(3) & "," & Data(4) & "," & Data(5) & "," & Data(6) & "," & Data(7) 'etc.
    lbl(0).height = Data(0)
    lbl(0).width = Data(1)
    lbl(0).Left = Data(2)
    lbl(0).Top = Data(3)
    lbl(0).ForeColor = Data(4)
    lbl(0).FontName = Data(5)
    lbl(0).FontSize = Data(6)
    lbl(0).FontBold = Data(7)
    End If

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Aug 2009
    Posts
    131

    Re: How to read and write combined data from/to the field

    Quote Originally Posted by Zvoni View Post
    Urggghhh..... and now i'm going to spice this up by introducing "Parent" to the controls.
    In a nutshell: Use JSON with Json-Objects, JSON-Fields, JSON-Arrays, JSON-ChildObjects etc. etc. blahblahblah and build a hierarchy, and save it as a single String or BLOB
    Thank you for your answer, do you have an example for this?

  9. #9
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    5,261

    Re: How to read and write combined data from/to the field

    Read the JSON-Documents (gazillions on the net)
    a JSON-Object can have Properties/Fields with simple Datatypes,
    can have properties/fields being an array of values,
    can have (Child-) Objects, which themselves can have….

    what does this remind you of?
    Last edited by Zvoni; Tomorrow at 31:69 PM.
    ----------------------------------------------------------------------------------------

    One System to rule them all, One Code to find them,
    One IDE to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ---------------------------------------------------------------------------------
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    ---------------------------------------------------------------------------------
    Code is like a joke: If you have to explain it, it's bad

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width