MS Office Forum / General MS InfoPath Questions / September 2005
Problems with an access workgroup?
|
|
Thread rating:  |
Oldie - 02 Aug 2005 16:39 GMT I designed my form based on an Access database table and I can query the data. However, when I try to submit data I am told I don't have permission. I guess that this is because the Access database is secured by means of a workgroup.
1. I am suprised that Infopath can read (and query) the data. Are there any security issues here i shuld know about?
2. How do I specify a workgroup (or user login) so I can submit the information? Does this have something to do with "trusted source" or am I on the wrong track?
The other possibility is that I am reading from an Access 2003 frontend which links to data in an Access 97 database. So effectively I am trying to write data to Access 97. I don't have control over this as some users still use an Access 97.mde frontend - which could be why I am trying to get Infopath to work in the first place! LOL
Any help appreciated!
Scott L. Heim [MSFT] - 02 Aug 2005 22:58 GMT Hi,
When you create your connection to the Access database, you will need to modify some of the properties so that you can specify the Workgroup Information File.
See if these steps help (and these are starting fresh to create a new connection and test form.)
- Create a new InfoPath solution and choose From Data Connection - Select Database and click Next - Click the Select Database button - Click the New Source button - Select Other/Advanced and click Next - Select the "Microsoft Jet 4.0 OLE DB Provider" option and click the "Next
>>" button - Click the builder button (...) next to Select or enter database name and locate your database - Click the "All" tab - Select the: Jet OLEDB:System database entry and click the Edit Value button - Enter the path to your MDW (Workgroup Information File) and include the actual file name (i.e. C:\MyWorkgroupFile.MDW) - If you want to store the User ID and Password, you can modify those options as well - Click OK
You should be able to now build a test form from this database and successfully submit to it as well!
I hope this helps!
Scott L. Heim Microsoft Developer Support
This posting is provided "AS IS" with no warranties, and confers no rights
Oldie - 08 Aug 2005 10:41 GMT Thanks Scott - I don't think I would have got there on my own!
I couldn't find any references to this in any of the Infopath texts I have read. I actually used your info to reset an existing database path to use a workgroup. I was getting very frustrated that I had "read" but not "write" access.
Took less than a minute to get this fixed. Brilliant!
Still new to Infopath but I can see its potential! Fantastic!
Regards, Oldie (Getting even older this week!)
> Hi, > [quoted text clipped - 32 lines] > > This posting is provided "AS IS" with no warranties, and confers no rights Scott L. Heim [MSFT] - 08 Aug 2005 14:44 GMT Hi,
Thank you for the update - I am glad that information helped! :-)
Technically, this is not specifically an "InfoPath" issue, which is why you probably did not see this in any InfoPath books.
When you create an OLEDB connection to Access from most any application, the same dialog is used and in order to specify the workgroup, user, etc. various "Extended Properties" need to be specified in the connection string for OLEDB hence the "All" tab on this dialog to allow modification of these properties.
Best Regards,
Scott L. Heim Microsoft Developer Support
This posting is provided "AS IS" with no warranties, and confers no rights
smaur - 08 Aug 2005 15:53 GMT Hi Scott, This is what I have been looking for, but I have a question... When a user interacts with the form, how can I ensure he is prompte with a dialog box that requests the username as well. When I tried the solution above I am prompted only for a password. have multiple users in the associated mdw, I would like them each to b able open the form and be prompted with a dialog box requring them t enter their unique usernames and passwords, the same way they do whe the interact directly with the database. How do I accomplish this? Thanks
-- smau
Scott L. Heim [MSFT] - 08 Aug 2005 18:16 GMT Hi,
By chance, would the "user id's" be the same as the user's network logon? If not, would you be able to have the user's enter their Access "user id" in a field on the form?
There are only a couple of options for making this work:
- After you initially setup the connection information, modify the Manifest.xsf file to remove the user id information and then when the user sees the prompt, they would need to cancel that initial box and would then get a prompt allowing them to enter user and password information. - Using code, you could modify the connection string for your data connection so that when the user executed the query, the code would automatically either pickup their logon name or get it from a field on the form so that they would only need to enter the password in the prompt that appears.
Here is a VBScript example of this option - this would be used on the click event of a button:
Dim strConn Dim strFind strConn = XDocument.DataAdapters(0).connection strFind = "User ID=""""" strConn = replace(strConn, strFind, "User ID = 'scott'") XDocument.DataAdapters(0).connection = strConn XDocument.Query
Let me know if you need any additional information on this!
Best Regards,
Scott L. Heim Microsoft Developer Support
This posting is provided "AS IS" with no warranties, and confers no rights
smaur - 08 Aug 2005 21:13 GMT Thanks Scott, I want to go with your second method, I am using jscript, and alread have code to obtain the current users network username. Adapting you code, i tried the following: function CTRL20_7::OnClick(eventObj) { var strConn; var oNetwork = new ActiveXObject("WScript.Network"); var strUserName = oNetwork.UserName;
strConn = XDocument.DataAdapters(0).connection;
strConn = replace(strConn, "MyAdmin", strUserName);
XDocument.DataAdapters(0).connection = strConn; XDocument.Query();
}
..where "MyAdmin" is the username I used when I sucessfully set up th Microsoft Jet 4.0 OLE DB Provider connection with the database (per you earlier post instructions). The error I get is "Object Expected", and it is on 'replace' line o code. I appreciate your help
-- smau
Scott L. Heim [MSFT] - 09 Aug 2005 14:18 GMT Hi Smaur,
I believe the issue you are seeing is because the sample code I provided was VBScript whereas you are using JScript.
Here is a modified sample using JScript:
function CTRL2_8::OnClick(eventObj) { var strConn; var oNetwork = new ActiveXObject("WScript.Network"); var strUserName = oNetwork.UserName;
strConn = XDocument.DataAdapters(0).Connection; strConn = strConn.replace(/MyAdmin/, "Test");
XDocument.DataAdapters(0).Connection = strConn; XDocument.Query(); }
You will notice the "replace" method is called differently and the letter "C" in "Connection" needs to be capitalized.
Let me know how this works! :-)
Scott L. Heim Microsoft Developer Support
This posting is provided "AS IS" with no warranties, and confers no rights
smaur - 09 Aug 2005 14:35 GMT Thanks Scott, I had figured out the correct syntax for the replace command fo jscript, but I had overlooked the 'connection' error, Works great now! thanks agai
-- smau
Scott L. Heim [MSFT] - 09 Aug 2005 15:38 GMT Hi Smaur,
That's great to hear - thank you for the update!
Best Regards,
Scott L. Heim Microsoft Developer Support
This posting is provided "AS IS" with no warranties, and confers no rights
smaur - 10 Aug 2005 19:45 GMT I recently applied the steps above to change the way an existing for connected to the Access database in order to enable workgroup security After sucessfuly modifying the data connection in this manner, all m form control bindings were lost, even though all the dataField an queryField and table names were unchanged, as was the connection nam (Main connection). The only differences I see are that I did change the name of th database before making by connection changes, and also, now appearin alongside the database is the file default.odc Is there a way that I could have made the desired connection change without having to re-associate the bindings between all the for controls and their data sources
-- smau
smaur - 10 Aug 2005 21:32 GMT I think I figured out the problem. What I did wrong was to change th Main connection, but I did not make the changes to the require secondary data sources. When I previewed the form it no longer had th connection to the secondary sources so it showed controls with n bindings. Subsequently I reconnected to the secondary data sources bu the damage was done and the bindings lost. To fix this I went to the last working backup of the form, made ALL o my changes to the data connections, and then opened/previewed the for and everything was fine
-- smau
smaur - 30 Sep 2005 15:10 GMT Hi, I have followed Scott's suggestions in Posts #2 and #8 of this thread my log on button code is below. My database connections have been se with "Microsoft Jet 4.0 OLE DB Provider option" and with usernam stored but no password stored.
function btnLogOn::OnClick(eventObj) { var strConn = XDocument.DataAdapters(0).Connection; var strUserName XDocument.DOM.selectSingleNode("//my:Username").text; var strPassWord XDocument.DOM.selectSingleNode("//my:PassWord").text;
strConn = strConn.replace(/myAdmin/, '"' + strUserName + '"'); strConn = strConn.replace(/Password=""/, "Password=" + '"' strPassWord + '"'); XDocument.DataAdapters(0).Connection = strConn; XDocument.Query(); }
But as it turns out, this isn't working afterall, when the button i clicked the user is prompted with a dialog box titled "Please enter M Jet OLE DB intialization information". I'd prefer if the user didn' get this box for obvious reasons. Apparently, although the 'XDocument.DataAdapters(0).Connection' no holds the user inputted username and pwd, (I verified this with an alert) InfoPath is not using it.
Any ideas as to what is wrong
|
|
|