Custom Code (VBScript) to retrieve values from an Access database

D

DavidGaravit

Hi,
I'm new in InfoPath interface and I really need your help. I'm working with
in a Purchase Requisition form and I need to assing, in an automatic way, the
following available PR number.

I created an Access database that has the unique ID column as the PR number,
and some other general fields (Name, Department, etc).

I was refering to the following url sample
http://enterprise-solutions.swits.n...tically-add-db-record-vbscript&c=infopath2003

That helped me a lot, but this is only covering the first part of my
project: submit information to Access in order to assing (inside the DB) the
PR number to the requestor.

The part that is missing, is how can I retrieve that assigned PR number,
using custome code.

Can some body help me on this matter????

Best regards.
 
D

DavidGaravit

Thanks a lot..........now my form is working 100%.

But, I had a new problem. This form in which I'm working on was created
since the begging linked with the data source (access database). That means,
that it is the Main Data Source.

I have another form that was created without data source. Later on, I added
it using: >Tools>Data Connections>Add.... (same access DB), and it was added
as a Secondary Data Source.

As far as I can see, the custom code that I'm using in the original form is
only related to the "Main Data source", but not to "Secondary", and my code
is not working in the second form.

This are some code lines that work in the 1st....2nd does not:
---------------------
Dim objFieldsDataNode
Dim objPlayerNode
Dim objNewPlayerNode
'
Set objFieldsDataNode =
XDocument.DOM.selectSingleNode("/dfs:myFields/dfs:dataFields")
'
Set objPlayerNode =
XDocument.DOM.selectSingleNode("/dfs:myFields/dfs:dataFields/d:player")
'
Set objNewPlayerNode = objPlayerNode.cloneNode(True)
 
D

DavidGaravit

Hi Erick
I decided to leave the form with the main data source as my access DB.

But I have another problem.

How can I specify the data source to submit??
This is the deal:
1) Insert some values in Access database
2) To insert them, I use: XDocument.Submit
3) Read the ID generated for the inserted value
4) Finally submit the form (by clicking a button) to a share point

The problem is that step (2) is generating me errors 'cause that command is
submitting to the Access database and to the sharepoint at the same time

How can I specify in step (2), to submit only to my Access DB???
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top