J
Jay
Hey,
I'm trying to create a form for employees to fill out and then submit the
form to an Access database. When the form loads I would like it to get the
users current user name and then query the database to see if there is an
entry for that user. If there is an entry it should populate the form for the
user automatically and then allow then to make any changes and submit the
form again. If there is no entry, then nothing should load in the form,
allowing them to complete and submit the form. As of right now the only thing
I can get to work are text boxes that show the users current user name,
domain name, and computer name. I can't get it to query the database OnLoad
based on the user name field. Also, if I make a new form from a data
connection and a text box bound to the UserName field in the table it won't
populate the field. It only does so if I create a new blank form, create the
text boxes, and use the following code:
//Create a WScript.Network object, which provides access to the user
data
var objNetwork = new ActiveXObject("WScript.network");
//Retrieve the UserName and write it into the my:UserName field
XDocument.DOM.selectSingleNode("/my:myFields/my:UserName").text
= objNetwork.UserName;
- Something similar is done for the domain name and computer name fields. So
again, I would like it to be able to read the user name field, see if the
name exists in the database, and if so populate the form.. if not, just leave
a blank form. I think this will also help in making sure one employee is not
able to view another employee's form. Thanks for any help.
Jay
I'm trying to create a form for employees to fill out and then submit the
form to an Access database. When the form loads I would like it to get the
users current user name and then query the database to see if there is an
entry for that user. If there is an entry it should populate the form for the
user automatically and then allow then to make any changes and submit the
form again. If there is no entry, then nothing should load in the form,
allowing them to complete and submit the form. As of right now the only thing
I can get to work are text boxes that show the users current user name,
domain name, and computer name. I can't get it to query the database OnLoad
based on the user name field. Also, if I make a new form from a data
connection and a text box bound to the UserName field in the table it won't
populate the field. It only does so if I create a new blank form, create the
text boxes, and use the following code:
//Create a WScript.Network object, which provides access to the user
data
var objNetwork = new ActiveXObject("WScript.network");
//Retrieve the UserName and write it into the my:UserName field
XDocument.DOM.selectSingleNode("/my:myFields/my:UserName").text
= objNetwork.UserName;
- Something similar is done for the domain name and computer name fields. So
again, I would like it to be able to read the user name field, see if the
name exists in the database, and if so populate the form.. if not, just leave
a blank form. I think this will also help in making sure one employee is not
able to view another employee's form. Thanks for any help.
Jay