Parameters From Window / User Follow

0
Avatar
Legacy Poster

Hello.

We want to print on each label the name of the windows user who printed it.
How can we access to those variables in a VB script? I have found nothing neither in the forum nor in other places.

Any help would be welcomed. Thanks.

7 comments

0
Avatar
Legacy Poster
Comment actions Permalink

Hi,
Do you want to print the name of the user from DB or else from the form itself.If you want to fetch the data from db you can handle it using vb script or else if you want to type the name in form textbox and print it on the lable then you have to pass the parameter.

Thanks
Phaneendra
0
Avatar
Legacy Poster
Comment actions Permalink

Hi,
I have an idea but i'm not sure will it works out well or not but, you write a coustom query here and access the textbox value by passing the parameter to the label.

Thanks,
Phaneendra
0
Avatar
Legacy Poster
Comment actions Permalink

Do this in your code part,

Dim btEngine As New Engine()
btEngine.Start()
Dim btFormat As LabelFormatDocument = btEngine.Documents.Open("c:\LabelName.btw")

' Set the QueryPrompt

btFormat.DatabaseConnections.QueryPrompts("UserName").Value = "cojayar"

' Print the label format

Dim result As Result = btFormat.Print()

Try to make an UserName field in your table, hope it will be usefull.

Thanks,
Phaneendra
0
Avatar
Shotaro Ito
Moderator
Comment actions Permalink

Hi Cojayar,

On BarTender Label format, create a text and select datasource as VB Script (MultiLine).

Set code as below:
[code]
Value = Application.SystemUserName
[/code]
Note that this only show user name, not domain name.

and Thanks for Cool code sample, Phaneendra!
0
Avatar
Legacy Poster
Comment actions Permalink

[quote name='Shotaro I -Seagull Support' timestamp='1324285982' post='1366']
Hi Cojayar,

On BarTender Label format, create a text and select datasource as VB Script (MultiLine).

Set code as below:
[code]
Value = Application.SystemUserName
[/code]
Note that this only show user name, not domain name.

and Thanks for Cool code sample, Phaneendra!
[/quote]
What if you would like to lookup the user's name in a database table based on the value of SystemUserName and then have that name print on the label along with the location (for example) of the user which would also be in a column of the database table?
0
Avatar
Legacy Poster
Comment actions Permalink

[quote name='Shotaro I -Seagull Support' timestamp='1324285982' post='1366']
Hi Cojayar,

On BarTender Label format, create a text and select datasource as VB Script (MultiLine).

Set code as below:
[code]
Value = Application.SystemUserName
[/code]
Note that this only show user name, not domain name.

and Thanks for Cool code sample, Phaneendra!
[/quote]
What if you would like to lookup the user's name in a database table based on the value of SystemUserName and then have that name print on the label along with the location (for example) of the user which would also be in a column of the database table?
0
Avatar
Shotaro Ito
Moderator
Comment actions Permalink

[quote name='Craig McD' timestamp='1339693512' post='2623']
What if you would like to lookup the user's name in a database table based on the value of SystemUserName and then have that name print on the label along with the location (for example) of the user which would also be in a column of the database table?
[/quote]
One idea is pull value from your own database connection by VB Script - after got an user name by script, query database by the user name.
About how to get database value by VB Script, [url="http://seagullscientific.invisionzone.com/index.php?/topic/608-serial-number-with-letters-and-numbers-from-excel/page__p__1727__hl__adodb.recordset__fromsearch__1#entry1727"]This post[/url] might helps.

Please sign in to leave a comment.