Sequence That Objects Are Generated/evaluated
Below is the vb script for a text field (old_series_name). I am using the value of a second field (style_number) in the select statement. The style_number field's datasource is Screen Data and I have 236 in the Screen Data box. When I preview the label, 236 is displayed in the field. And the database table has a record with style=236 and old_series=test, so everything is set up correctly.
When I preview the label, the field is blank. When I uncomment the msgbox line of code and run it, I get the following in the msgbox:
Select old_series from tblData where style='';
So, it appears that bartender is generating the old_series_name field before the style_number. Is there a way to force bartender to generate the style_number field first? Is there a way to see the sequence in which bartender generates/evaluates fields.
Thanks,
Steve
dim con
dim objConn
dim objRecordset
con = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\\Jasperfs01\Users02\1017178\My Documents\BarTender.accdb; Persist Security Info=False;"
Set objConn = CreateObject("ADODB.Connection")
objConn.Open con
Set myCommand = CreateObject("ADODB.Command" )
Set myCommand.ActiveConnection = objConn
set objRecordset=CreateObject("ADODB.recordset")
objConn.BeginTrans
myCommand.CommandText= "Select old_series from tblData where style='" & Format.Objects("style_number").Value & "';"
'msgbox mycommand.commandtext
set objRecordset= myCommand.Execute
objConn.CommitTrans
If NOT objRecordset.EOF then
value=objRecordset.fields("old_series").value
End If
objConn.Close
When I preview the label, the field is blank. When I uncomment the msgbox line of code and run it, I get the following in the msgbox:
Select old_series from tblData where style='';
So, it appears that bartender is generating the old_series_name field before the style_number. Is there a way to force bartender to generate the style_number field first? Is there a way to see the sequence in which bartender generates/evaluates fields.
Thanks,
Steve
dim con
dim objConn
dim objRecordset
con = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\\Jasperfs01\Users02\1017178\My Documents\BarTender.accdb; Persist Security Info=False;"
Set objConn = CreateObject("ADODB.Connection")
objConn.Open con
Set myCommand = CreateObject("ADODB.Command" )
Set myCommand.ActiveConnection = objConn
set objRecordset=CreateObject("ADODB.recordset")
objConn.BeginTrans
myCommand.CommandText= "Select old_series from tblData where style='" & Format.Objects("style_number").Value & "';"
'msgbox mycommand.commandtext
set objRecordset= myCommand.Execute
objConn.CommitTrans
If NOT objRecordset.EOF then
value=objRecordset.fields("old_series").value
End If
objConn.Close
0
-
Update: To test my theory, I deleted the style_number field and then recreated the same field thinking that this might resequence the order. Now the old_series field is populated properly with "test"! It appears that bartender is now evaluating the style_number field before the old_series field.
Now the msgbox displays:
Select old_series from tblData where style='236';
So, I think I've learned that bartender generates/evaluates each label object in a sequence (object1, object2...object18). If object5 is dependent on object6, the results may be wrong because object6 thru object18 will still be NULL when object5 is being generated/evaluated.
If that is correct, how can you determine the sequence of objects for a format? Also, how do you move an object up or down in the sequence?0
Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.
Kommentare
1 Kommentar