|
-
Aug 30th, 2022, 02:23 AM
#1
Thread Starter
Addicted Member
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.
-
Aug 30th, 2022, 02:57 AM
#2
Re: How to read and write combined data from/to the field
How do you have more than 255 properties for a single control??
-
Aug 30th, 2022, 03:05 AM
#3
Thread Starter
Addicted Member
Re: How to read and write combined data from/to the field
 Originally Posted by Arnoutdv
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.
-
Aug 30th, 2022, 03:46 AM
#4
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.
-
Aug 30th, 2022, 04:32 AM
#5
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
-
Aug 30th, 2022, 11:02 AM
#6
Thread Starter
Addicted Member
Re: How to read and write combined data from/to the field
 Originally Posted by Arnoutdv
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|, ..."
-
Aug 30th, 2022, 11:06 AM
#7
Thread Starter
Addicted Member
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
-
Aug 30th, 2022, 11:08 AM
#8
Thread Starter
Addicted Member
Re: How to read and write combined data from/to the field
 Originally Posted by Zvoni
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?
-
Aug 30th, 2022, 12:19 PM
#9
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|