Guest_imported
New member
- Jan 1, 1970
- 0
If somone could please help me with this problem
I am trying to get the field name values from an Access Database. I have SQL statement that grabs the specfic field name VAR_NAME from a Table with the selected Criteria. I know this part works fine.
Suppose under var_name I have seven different variables like QTY, Buy, Sell, ACCT, Etc.
How do I loop through these and place them in the label1(x) control array that I have on the form. It is suppose to be done dynamically but I kinda cheated by putting the labels already on the form and when they are used just turn the visibility property to true.
I have been able to get the first the variable in the label but not the rest. Here is what my code looks like
Dim x As Integer
Set Db = OpenDatabase("D:\BegDB\DB1.mdb"
Set Rs = Db.OpenRecordset("SCREEN_DEFINITIONS_DETAILS", dbOpenSnapshot)
mySQL = "SELECT Var_Name FROM SCREEN_DEFINITIONS_DETAILS WHERE System_Id = '" & sysIdString & "' AND Screen_Id = '" & screenIdString & "'"
myDataClass.ProcessCMD (Index)
'Print sysIdString
'Print screenIdString
Set Rs = Db.OpenRecordset(mySQL)
For x = 0 To 10
Label1(x).Caption = Rs.Fields(x)
Next x
ANY help would be great thanks
-M
I am trying to get the field name values from an Access Database. I have SQL statement that grabs the specfic field name VAR_NAME from a Table with the selected Criteria. I know this part works fine.
Suppose under var_name I have seven different variables like QTY, Buy, Sell, ACCT, Etc.
How do I loop through these and place them in the label1(x) control array that I have on the form. It is suppose to be done dynamically but I kinda cheated by putting the labels already on the form and when they are used just turn the visibility property to true.
I have been able to get the first the variable in the label but not the rest. Here is what my code looks like
Dim x As Integer
Set Db = OpenDatabase("D:\BegDB\DB1.mdb"
Set Rs = Db.OpenRecordset("SCREEN_DEFINITIONS_DETAILS", dbOpenSnapshot)
mySQL = "SELECT Var_Name FROM SCREEN_DEFINITIONS_DETAILS WHERE System_Id = '" & sysIdString & "' AND Screen_Id = '" & screenIdString & "'"
myDataClass.ProcessCMD (Index)
'Print sysIdString
'Print screenIdString
Set Rs = Db.OpenRecordset(mySQL)
For x = 0 To 10
Label1(x).Caption = Rs.Fields(x)
Next x
ANY help would be great thanks
-M