kyprogrammer
Registered User.
- Local time
- Today, 11:44
- Joined
- Oct 5, 2016
- Messages
- 14
Hey All,
I know I have read that this may not be possible but I wanted to submit this anyways. I have a module that detects a count of records in a table fitting a criteria. It then concatenates a string including the number so that it adds this string to a variable. FYI I am using this in MS Access
The variable is then sent to the procedure to be "evaluated" as vba code, but I am stuck there.
Here is my First procedure.
Public Sub checkNumFields()
Dim myPartID, myCount, i As Integer
Dim myPartNum As String
Dim mytext As Variant
myPartNum = Form_QC_ASSY_Check_Main_frm.cbo_Part_Number
myPartID = Int(DLookup("Part_ID", "Part_Number_Table", "[ASSY_Part_Number]='" & myPartNum & "'"))
myCount = Int(DCount("Check_Point", "qry_ASSY_QC_Check_Info", "[Part_ID]=" & myPartID))
If (myccount = 0) Then
i = myCount + 1
For i = 1 To myCount
mytext = "QC_ASSY_Check_Main_frm.tab_QC_Attribute_Checks.txt_P" & i & ".visible = True"
'sends the variable mytext to the form procedure
Call Form_QC_ASSY_Check_Main_frm.ShowMyFields(mytext, i)
Next i
Else
For i = 1 To myCount
mytext = "Form_QC_ASSY_Check_Main_frm.txt_p' & i & '.visible = True"
Next i
End If
The form procedure is this
Public Function ShowMyFields(mytext, i)
Eval (mytext)
End Function
In theory the first record would have mytext = QC_ASSY_Check_Main_frm.tab_QC_Attribute_Checks.txt_P1.visible = True
This would unhide that first field and be sent back to the original procedure and goto the next count. However, when the string is trying to be evaluated it says it can't find "QC_ASSY_Check_Main_frm" even though it's spelled correctly.
Any help?:banghead:
I know I have read that this may not be possible but I wanted to submit this anyways. I have a module that detects a count of records in a table fitting a criteria. It then concatenates a string including the number so that it adds this string to a variable. FYI I am using this in MS Access
The variable is then sent to the procedure to be "evaluated" as vba code, but I am stuck there.
Here is my First procedure.
Public Sub checkNumFields()
Dim myPartID, myCount, i As Integer
Dim myPartNum As String
Dim mytext As Variant
myPartNum = Form_QC_ASSY_Check_Main_frm.cbo_Part_Number
myPartID = Int(DLookup("Part_ID", "Part_Number_Table", "[ASSY_Part_Number]='" & myPartNum & "'"))
myCount = Int(DCount("Check_Point", "qry_ASSY_QC_Check_Info", "[Part_ID]=" & myPartID))
If (myccount = 0) Then
i = myCount + 1
For i = 1 To myCount
mytext = "QC_ASSY_Check_Main_frm.tab_QC_Attribute_Checks.txt_P" & i & ".visible = True"
'sends the variable mytext to the form procedure
Call Form_QC_ASSY_Check_Main_frm.ShowMyFields(mytext, i)
Next i
Else
For i = 1 To myCount
mytext = "Form_QC_ASSY_Check_Main_frm.txt_p' & i & '.visible = True"
Next i
End If
The form procedure is this
Public Function ShowMyFields(mytext, i)
Eval (mytext)
End Function
In theory the first record would have mytext = QC_ASSY_Check_Main_frm.tab_QC_Attribute_Checks.txt_P1.visible = True
This would unhide that first field and be sent back to the original procedure and goto the next count. However, when the string is trying to be evaluated it says it can't find "QC_ASSY_Check_Main_frm" even though it's spelled correctly.
Any help?:banghead:
Last edited: