Solved

How to repeat the structure of xml in visualbasic

Posted on 2001-07-25
42
179 Views
Last Modified: 2013-11-25
Hi

I have a question for you all: My question is:

I got an xml file which looks like:

<import detail>
<detail>
<time>bla bla</time>
<date>bla bla</date>
<start>bla bla</start>
</detail>
</import detail>

I'm creating the above xml file using DOM document in visualbasic using xml parser ver 3.0. for example it looks like this:

Set objparent = m_objimporter.createElement("import detail")
m_objimporter.appendChild objparent
objparent.setAttribute "template", "Default"

Set objtradeimport = m_objimporter.createElement("time")
objparent.appendChild objtradeimport
objtradeimport.setAttribute "type", B_tradetype
'
'
'
etc...

My problem is:

I want to send the detail fields again and again in the same xml file like:
<import detail>
<detail>
<time>bla bla</time>
<date>bla bla</date>
<start>bla bla</start>
</detail>
<detail>
<time>bla bla</time>
<date>bla bla</date>
<start>bla bla</start>
</detail>
<detail>
<time>bla bla</time>
<date>bla bla</date>
<start>bla bla</start>
</detail>
</import detail>

I have different time,date,start values every time i sent and i want basically to repeat the detail information again and filled with different values in the sam xml file.
How can i acheive that.

-Cheers
0
Comment
Question by:vmandem
  • 22
  • 16
  • 4
42 Comments
 
LVL 8

Expert Comment

by:Dave_Greene
Comment Utility
If I'm reading the question correctly... here is what I would do.

Build your DOM

If oDOM Is Nothing Then
       
       Set oDOM = New DOMDocument
       '
       ' New Document, add headings
       '
       Set oNode = oDOM.createProcessingInstruction("xml", "version='1.0'")
       Set oNode = oDOM.insertBefore(oNode, oDOM.childNodes.Item(0))
       
       '
       ' Create document roots
       '
       Set oRoot = m_XML_DOM.createElement("import_detail")
       Set m_XML_DOM.documentElement = oRoot
       
       Set oChild = m_XML_DOM.createElement("Detail")
       oRoot.appendChild oChild

       Set oNode = oChild

   End If

Build your node

   Dim oAttrib     As IXMLDOMAttribute

   '
   ' set node attributes
   '
   Set oAttrib = m_XML_DOM.createAttribute("time")
   oAttrib.Text = ""  'blank value for default node
   oNode.Attributes.setNamedItem oAttrib
   
   Set oAttrib = m_XML_DOM.createAttribute("date")
   oAttrib.Text = m_Offset
   oNode.Attributes.setNamedItem oAttrib

   Set oAttrib = m_XML_DOM.createAttribute("start")
   oAttrib.Text = m_Offset
   oNode.Attributes.setNamedItem oAttrib

   Dim xNode       As IXMLDOMNode

   For i = 1 to NumberDesired
      Set xNode = oNode
     

      xNode.Attributes.getNamedItem("time").Text = sTime
      xNode.Attributes.getNamedItem("date").Text = sDate
      xNode.Attributes.getNamedItem("start").Text = sStart
     
      oRoot.appendChild xNode  
   Next

   

0
 
LVL 8

Expert Comment

by:Dave_Greene
Comment Utility
one change


  oAttrib.Text = ""  'for all
0
 

Author Comment

by:vmandem
Comment Utility
Dave

I'm already creating the whole structure like :

<?xml version="1.0"> etc..

And i got the whole structure of the xml file the way i explained earlier:

Do i need to check the: If condition you mentioned at the beginning.

I only want to repeat the <detail>----------</detail> tag repeated in the same structure but i'm passing different values for:time,date,start fields.


AND I can't understand at this point in ur code:

Set oAttrib = m_XML_DOM.createAttribute("time")
  oAttrib.Text = ""  'blank value for default node
  oNode.Attributes.setNamedItem oAttrib
 
  Set oAttrib = m_XML_DOM.createAttribute("date")
  oAttrib.Text = m_Offset
  oNode.Attributes.setNamedItem oAttrib


what is the blank value for default node and m_Offset.

I'm using this way to build the structure:

Dim m_objimporter As New DOMDocument

--Before this i'm creating <import detail> element.

Set objdetail = m_objimporter.createElement("Detail")
objimport.appendChild objdetail

Set objNewchild = m_objimporter.createElement("time")
objNewchild.Text = str1
objdetail.appendChild objNewchild

Set objNewchild = m_objimporter.createElement("date")
objNewchild.Text = str2
objdetail.appendChild objNewchild

Set objNewchild = m_objimporter.createElement("start")
objNewchild.Text = str3
objdetail.appendChild objNewchild

-VM
0
 
LVL 8

Expert Comment

by:Dave_Greene
Comment Utility
The blank value, if to create a dummy node that you can easily populate with data.

If you create the template.  then appending large amounts of data will run faster and be programmatically easier.

That's whats going on here

For i = 1 to NumberDesired
     Set xNode = oNode  <--- Copy of the template, where onode was created as the template

     xNode.Attributes.getNamedItem("time").Text = sTime
     xNode.Attributes.getNamedItem("date").Text = sDate
     xNode.Attributes.getNamedItem("start").Text = sStart
     
     oRoot.appendChild xNode   <-- add the new values
  Next
0
 
LVL 8

Expert Comment

by:Dave_Greene
Comment Utility
You really don't want to do all of that appending as your example shows. Really slow.
0
 

Author Comment

by:vmandem
Comment Utility
Dave

I'm already creating the whole structure like :

<?xml version="1.0"> etc..

And i got the whole structure of the xml file the way i explained earlier:

Do i need to check the: If condition you mentioned at the beginning.

I only want to repeat the <detail>----------</detail> tag repeated in the same structure but i'm passing different values for:time,date,start fields.


AND I can't understand at this point in ur code:

Set oAttrib = m_XML_DOM.createAttribute("time")
  oAttrib.Text = ""  'blank value for default node
  oNode.Attributes.setNamedItem oAttrib
 
  Set oAttrib = m_XML_DOM.createAttribute("date")
  oAttrib.Text = m_Offset
  oNode.Attributes.setNamedItem oAttrib


what is the blank value for default node and m_Offset.

I'm using this way to build the structure:

Dim m_objimporter As New DOMDocument

--Before this i'm creating <import detail> element.

Set objdetail = m_objimporter.createElement("Detail")
objimport.appendChild objdetail

Set objNewchild = m_objimporter.createElement("time")
objNewchild.Text = str1
objdetail.appendChild objNewchild

Set objNewchild = m_objimporter.createElement("date")
objNewchild.Text = str2
objdetail.appendChild objNewchild

Set objNewchild = m_objimporter.createElement("start")
objNewchild.Text = str3
objdetail.appendChild objNewchild

-VM
0
 

Author Comment

by:vmandem
Comment Utility
Dave

I'm getting an error at the : xNode.Attributes.(at arrow shown)

For i = 1 To 20
Set xNode = objTradedetail

-->xNode.Attributes.getNamedItem("times").Text = str1

error: Object variable or with block variable not set.

what could be the problem.
0
 
LVL 8

Expert Comment

by:Dave_Greene
Comment Utility
Sorry, typo  

xNode.Attributes.getNamedItem("time").Text = str1
 
Remove the extra "s" in time(s)
0
 

Author Comment

by:vmandem
Comment Utility
dave still it is giving the same error. What it could be.

Thanks
Vmandem
0
 
LVL 8

Expert Comment

by:Dave_Greene
Comment Utility
V,

Could you post your whole routine, it could be many different things now.

Thanks
-D
0
 

Author Comment

by:vmandem
Comment Utility
sure here you go:

dim m_objimporter as new domdocument
Dim objparent As IXMLDOMElement
Dim objNewchild As IXMLDOMElement
Dim objdetail As IXMLDOMElement
Dim objtradeimport As IXMLDOMElement
Dim xNode As IXMLDOMNode

Set objparent = m_objimporter.createElement("importFile")
m_objimporter.appendChild objparent
objparent.setAttribute "template", "Default"

Set objtradeimport = m_objimporter.createElement("tradeImport")
objparent.appendChild objtradeimport
objtradeimport.setAttribute "type", B_tradetype

Set objNewchild = m_objimporter.createElement("audit")
objNewchild.Text = "NEW"
objtradeimport.appendChild objNewchild


 Set objTradedetail = m_objimporter.createElement("Detail")
 objtradeimport.appendChild objTradedetail

Set objNewchild = m_objimporter.createElement("times")
objNewchild.Text = B_starttime
objTradedetail.appendChild objNewchild

Set objNewchild = m_objimporter.createElement("timee")
objNewchild.Text = B_stoptime
objTradedetail.appendChild objNewchild

Set objNewchild = m_objimporter.createElement("dates")
objNewchild.Text = Newdeliveryperiod
objTradedetail.appendChild objNewchild

Set objNewchild = m_objimporter.createElement("datee")
objNewchild.Text = Newtoperiod
objTradedetail.appendChild objNewchild

Here i'm doing your stuff:

For i = 1 To 20
Set xNode = objTradedetail
xNode.Attributes.getNamedItem("times").Text = B_starttime
xNode.Attributes.getNamedItem("timee").Text = B_stoptime
xNode.Attributes.getNamedItem("dates").Text = Newdeliveryperiod
xNode.Attributes.getNamedItem("datee").Text = Newtoperiod
xNode.Attributes.getNamedItem("price").Text = B_price
xNode.Attributes.getNamedItem("days").Text = B_tradecalendar

objTradedetail.appendChild xNode
Next i

0
 
LVL 3

Expert Comment

by:Hornet241
Comment Utility
Hi vmandem, try this

NOTE - I moved your Append to inside the for loop to add the nodes as required

For i = 1 To 20
    objtradeimport.appendChild objTradedetail
    Set xNode = objtradeimport.GetElementByTagname("Detail").Item(i - 1)
    xNode.GetElementByTagname("times").Item(0).Text = B_starttime
    xNode.GetElementByTagname("timee").Item(0).Text = B_stoptime
    xNode.GetElementByTagname("dates").Item(0).Text = Newdeliveryperiod
    xNode.GetElementByTagname("datee").Item(0).Text = Newtoperiod
    xNode.GetElementByTagname("price").Item(0).Text = B_price
    xNode.GetElementByTagname("days").Item(0).Text = B_tradecalendar

Next i

0
 
LVL 8

Expert Comment

by:Dave_Greene
Comment Utility
I see your problem, you created elements instead of attributes.  Element lists are slower than attributes of a node in DOM so I suggest you create the attributes instead of the elements...  here is my code again

<<
  Dim oAttrib     As IXMLDOMAttribute

  '
  ' set node attributes
  '
  Set oAttrib = m_XML_DOM.createAttribute("time")
  oAttrib.Text = ""  'blank value for default node
  oNode.Attributes.setNamedItem oAttrib
 
  Set oAttrib = m_XML_DOM.createAttribute("date")
  oAttrib.Text = m_Offset
  oNode.Attributes.setNamedItem oAttrib

  Set oAttrib = m_XML_DOM.createAttribute("start")
  oAttrib.Text = m_Offset
  oNode.Attributes.setNamedItem oAttrib
>>
0
 

Author Comment

by:vmandem
Comment Utility
Dave the problem is i have to change a lot of code that will impact me more and will take more time, the code i posted is very small but there is lot of code involved in this, that is why i want to follow the element method. could you please tell me a method to do that.

comment for Hornett:

Hornet i tried your method but when i say xNode.    i can't see Getelementbytagname option what could be the reason.

I declared xNode as ixmldomelement in your case.
but when i say objtradeimport.   i can see the getelementbytagname option.

0
 
LVL 8

Expert Comment

by:Dave_Greene
Comment Utility
Ok, We'll modify it the element way.  One sec
0
 

Author Comment

by:vmandem
Comment Utility
Dave the problem is i have to change a lot of code that will impact me more and will take more time, the code i posted is very small but there is lot of code involved in this, that is why i want to follow the element method. could you please tell me a method to do that.

comment for Hornett:

Hornet i tried your method but when i say xNode.    i can't see Getelementbytagname option what could be the reason.

I declared xNode as ixmldomelement in your case.
but when i say objtradeimport.   i can see the getelementbytagname option.

0
 

Author Comment

by:vmandem
Comment Utility
Dave the problem is i have to change a lot of code that will impact me more and will take more time, the code i posted is very small but there is lot of code involved in this, that is why i want to follow the element method. could you please tell me a method to do that.

comment for Hornett:

Hornet i tried your method but when i say xNode.    i can't see Getelementbytagname option what could be the reason.

I declared xNode as ixmldomelement in your case.
but when i say objtradeimport.   i can see the getelementbytagname option.

0
 

Author Comment

by:vmandem
Comment Utility
Dave the problem is i have to change a lot of code that will impact me more and will take more time, the code i posted is very small but there is lot of code involved in this, that is why i want to follow the element method. could you please tell me a method to do that.

comment for Hornett:

Hornet i tried your method but when i say xNode.    i can't see Getelementbytagname option what could be the reason.

I declared xNode as ixmldomelement in your case.
but when i say objtradeimport.   i can see the getelementbytagname option.

0
 
LVL 8

Expert Comment

by:Dave_Greene
Comment Utility
Here is what I would do

dim m_objimporter as new domdocument
Dim objparent As IXMLDOMElement
Dim objNewchild As IXMLDOMElement
Dim objdetail As IXMLDOMElement
Dim objtradeimport As IXMLDOMElement

Set objparent = m_objimporter.createElement("importFile")
m_objimporter.appendChild objparent
objparent.setAttribute "template", "Default"

Set objtradeimport = m_objimporter.createElement("tradeImport")
objparent.appendChild objtradeimport
objtradeimport.setAttribute "type", B_tradetype

Set objNewchild = m_objimporter.createElement("audit")
objNewchild.Text = "NEW"
objtradeimport.appendChild objNewchild


Set objTradedetail = m_objimporter.createElement("Detail")
objtradeimport.appendChild objTradedetail

'call the new sub here
For i = 1 To 20
   LoadNodes(Start(i), Stop(i), Delivery(i), Period(i)
Next i

'Create a sub to perform the child loads

Private Sub LoadNodes(B_starttime as string, B_stoptime as string, Newdeliveryperiod as string, Newtoperiod as string)

   Set objNewchild = m_objimporter.createElement("times")
   objNewchild.Text = B_starttime
   objTradedetail.appendChild objNewchild

   Set objNewchild = m_objimporter.createElement("timee")
   objNewchild.Text = B_stoptime
   objTradedetail.appendChild objNewchild

   Set objNewchild = m_objimporter.createElement("dates")
   objNewchild.Text = Newdeliveryperiod
   objTradedetail.appendChild objNewchild

   Set objNewchild = m_objimporter.createElement("datee")
   objNewchild.Text = Newtoperiod
   objTradedetail.appendChild objNewchild

End Sub
0
 

Author Comment

by:vmandem
Comment Utility
Dave it is giving me error:

expected expression at this line:

LoadNodes(Start(i),stop(i),Delivery(i),Period(i))

-->AT: stop(i)

the whole line appears in Red
0
 

Author Comment

by:vmandem
Comment Utility
Dave it is giving me error:

expected expression at this line:

LoadNodes(Start(i),stop(i),Delivery(i),Period(i))

-->AT: stop(i)

the whole line appears in Red
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 8

Expert Comment

by:Dave_Greene
Comment Utility
These are the values you want to put into the nodes

I have suggested the use of string arrays... but didn't code to it.

Use this for testing purposes

Dim Start(20) as string
Dim Stop(20) as string
Dim Delivery(20) as string
Dim Period(20) as string

For i = 1 to 20
  Start(i) = "Start" & i
  Stop(i) = "Stop" & i
  Delivery(i) = "Delivery" & i
  Period(i) = "Period" & i
Next

'call the new sub here
For i = 1 To 20
  LoadNodes(Start(i), Stop(i), Delivery(i), Period(i)
Next i
0
 

Author Comment

by:vmandem
Comment Utility
Still i find error at LoadNodes(start(i).....)

Error is: compile error, expected =

and the whole statement is in red.

Earlier i got error with stop(i) because stop is a keyword in visualbasic but now i'm getting the above error.

It is expecting something at the end of LoadNodes(start(i),...)=

 
0
 
LVL 8

Expert Comment

by:Dave_Greene
Comment Utility
Sorry!

Call LoadNodes(Start(i), Stop(i), Delivery(i), Period(i))
0
 

Author Comment

by:vmandem
Comment Utility
Dave

Now i found different error.

In the procedure i'm getting:

object variable or with block variable not set.

Dim m_objimporter As New DOMDocument
 Dim objparent As IXMLDOMElement
 Dim objNewchild As IXMLDOMElement
 Dim objdetail As IXMLDOMElement
 Dim objtradeimport As IXMLDOMElement
 Dim objTradedetail As IXMLDOMElement
 
  Set objNewchild = m_objimporter.createElement("times")
-->objNewchild.Text = B_starttime
  objTradedetail.appendChild objNewchild

  Set objNewchild = m_objimporter.createElement("timee")
  objNewchild.Text = B_stoptime
  objTradedetail.appendChild objNewchild

  Set objNewchild = m_objimporter.createElement("dates")
  objNewchild.Text = Newdeliveryperiod
  objTradedetail.appendChild objNewchild

  Set objNewchild = m_objimporter.createElement("datee")
  objNewchild.Text = Newtoperiod
  objTradedetail.appendChild objNewchild

End Sub


It is showing error at the arrow i mentioned above.
I thought i didn't declared variables, so i declared the variables at the beginning of procedure, still it gives me the above error. what could be the problem.

Thanks
0
 
LVL 8

Expert Comment

by:Dave_Greene
Comment Utility
It's because this statement didn't create the node

m_objimporter.createElement("times")


Make sure m_objimporter is in scope
0
 

Author Comment

by:vmandem
Comment Utility
I think it is with in the scope:m_objimporter

Because i'm able to create the same nodes outside of procedure first time but when i call this procedure it is failing.

The procedure typically looks like the one you created earlier.

Now i made a small addition at the beginning adding:

 Set objTradedetail = m_objimporter.createElement("tradeDetail")
  objtradeimport.appendChild objTradedetail
 
because i want the file looks like:

<import detail>
<tradeDetail>
<times>bla bla</times>
<dates>bla bla</dates>
<timee>bla bla</timee>
</detail>
<detail>
<time>bla bla</time>
<date>bla bla</date>
<start>bla bla</start>
</detail>
</import detail>
 
But still giving the same error at the beginning :
set objTradedetail= ..

'THE PROCEDURE STARTS:

Private Sub LoadNodes(B_starttime As String, B_stoptime As String, Newdeliveryperiod As String, Newtoperiod As String)

 Dim m_objimporter As New DOMDocument
 Dim objparent As IXMLDOMElement
 Dim objNewchild As IXMLDOMElement
 Dim objdetail As IXMLDOMElement
 Dim objtradeimport As IXMLDOMElement
 Dim objTradedetail As IXMLDOMElement
 
  Set objTradedetail = m_objimporter.createElement("tradeDetail")
  objtradeimport.appendChild objTradedetail
 
  Set objNewchild = m_objimporter.createElement("times")
  objNewchild.Text = B_starttime
  objTradedetail.appendChild objNewchild

  Set objNewchild = m_objimporter.createElement("timee")
  objNewchild.Text = B_stoptime
  objTradedetail.appendChild objNewchild

  Set objNewchild = m_objimporter.createElement("dates")
  objNewchild.Text = Newdeliveryperiod
  objTradedetail.appendChild objNewchild

  Set objNewchild = m_objimporter.createElement("datee")
  objNewchild.Text = Newtoperiod
  objTradedetail.appendChild objNewchild

End Sub
0
 

Author Comment

by:vmandem
Comment Utility
sorry the xml file must look like:

<import detail>
<tradeDetail>
<times>bla bla</times>
<dates>bla bla</dates>
<timee>bla bla</timee>
</tradeDetail>
<tradeDetail>
<time>bla bla</time>
<date>bla bla</date>
<start>bla bla</start>
</tradeDetail>
</import detail>
0
 
LVL 8

Expert Comment

by:Dave_Greene
Comment Utility
Make the DOM locally global.  Move the DIM statement to the top of the form.

Option Explicit

Dim m_objimporter As New DOMDocument



0
 

Author Comment

by:vmandem
Comment Utility
Now it is asking for :

Object required.

Error Number:424

I moved as you said.

Failing at:
-->Set objTradedetail = m_objimporter.createElement("tradeDetail")
0
 
LVL 8

Expert Comment

by:Dave_Greene
Comment Utility
Then what else could it be???  Missing object...

Dim objTradedetail As IXMLDOMElement
0
 

Author Comment

by:vmandem
Comment Utility
If i tried removing option explicit and tried declaring the variables in the procedure it is showing:

Object variable or with block variable not set

Else

it is giving:
Object required

I'm just wondering what it could be, i tested all the ways still it is showing the above errors.
0
 
LVL 8

Expert Comment

by:Dave_Greene
Comment Utility
Can't help you on this one, make sure everything is typed in correctly... good luck
0
 

Author Comment

by:vmandem
Comment Utility
Ok thankyou Dave for your help. I will try and i will let you know.

Thanks
VM
0
 
LVL 8

Expert Comment

by:Dave_Greene
Comment Utility
Keep me posted...  It could be that the object being created from the createelement statement is causing the problem

check it like so

If isnothing(objTradedetail) then msgbox "It didn't get applied"
0
 

Author Comment

by:vmandem
Comment Utility
I will, still testing but finding the same problem. I don't no why it is giving that. I will definetly post you.

Thanks
VM
0
 
LVL 3

Expert Comment

by:Hornet241
Comment Utility
Hi sorry I was away,

If you don't declare any of the elements or nodes, or you declare them just as Objects you should have no problem

Note where I use the .Item(i-1) and the .Item(0)
0
 
LVL 3

Expert Comment

by:Hornet241
Comment Utility
Hi I've done alot of checking and I found that when you use the .appendchild method to a node it completely associates the variable appended to the node so if you try to append the variable again you get no error but you still have only one child node

you can look at this by checking the .xml property of your objTradedetail element as you change the text values of the append child node.

Also I typo'd on the method  
     
     GetElementByTagName
It Should be
     GetElementsByTagName

Later
0
 

Author Comment

by:vmandem
Comment Utility
Hornet

I'm getting an error at the second line of the code:

Error is: Object variable or with block variable not set.


Dim xNode As IXMLDOMElement
For i = 1 To 2
   objtradeimport.appendChild objTradedetail
   Set xNode = objtradeimport.getElementsByTagName("Detail").Item(i - 1)
--> xNode.getElementsByTagName("times").Item(0).Text = B_starttime
   xNode.getElementsByTagName("timee").Item(0).Text = B_stoptime
   xNode.getElementsByTagName("dates").Item(0).Text = Newdeliveryperiod
   xNode.getElementsByTagName("datee").Item(0).Text = Newtoperiod
   xNode.getElementsByTagName("price").Item(0).Text = B_price
   xNode.getElementsByTagName("days").Item(0).Text = B_tradecalendar

Next i

It comes up at the arrow shown above. and when i put my mouse cursor at the set xNode it shows Nothing.

0
 

Author Comment

by:vmandem
Comment Utility
Hornet

First time the loop goes fine but when it comes second time into the loop, it is failing showing:
object variable or with block variable not set at the arrow shown in the previous comment.
what could be the problem. when i go and see the xml file
the structure <detail>...</detail> apperas only once and it is not repeated.

0
 
LVL 3

Accepted Solution

by:
Hornet241 earned 50 total points
Comment Utility
This code works


Dim m_objimporter As New domdocument

Set objparent = m_objimporter.createElement("importFile")
m_objimporter.appendChild objparent
objparent.setAttribute "template", "Default"

Set objtradeimport = m_objimporter.createElement("tradeImport")
objparent.appendChild objtradeimport
objtradeimport.setAttribute "type", B_tradetype

Set objNewchild = m_objimporter.createElement("audit")
objNewchild.Text = "NEW"
objtradeimport.appendChild objNewchild


Set objTradedetail = m_objimporter.createElement("Detail")

Set objNewchild = m_objimporter.createElement("times")
objTradedetail.appendChild objNewchild

Set objNewchild = m_objimporter.createElement("timee")
objTradedetail.appendChild objNewchild

Set objNewchild = m_objimporter.createElement("dates")
objTradedetail.appendChild objNewchild

Set objNewchild = m_objimporter.createElement("datee")
objTradedetail.appendChild objNewchild

Set objNewchild = m_objimporter.createElement("price")
objTradedetail.appendChild objNewchild

Set objNewchild = m_objimporter.createElement("days")
objTradedetail.appendChild objNewchild


For i = 1 To 20
objtradeimport.appendChild objTradedetail
Set xNode = objtradeimport.getElementsByTagName("Detail").Item(i - 1)
xNode.getElementsByTagName("times").Item(0).Text = B_starttime
xNode.getElementsByTagName("timee").Item(0).Text = B_stoptime
xNode.getElementsByTagName("dates").Item(0).Text = Newdeliveryperiod
xNode.getElementsByTagName("datee").Item(0).Text = Newtoperiod
xNode.getElementsByTagName("price").Item(0).Text = B_price
xNode.getElementsByTagName("days").Item(0).Text = B_tradecalendar

Set MyNewNode = xNode.cloneNode(True)
Set objTradedetail = MyNewNode

Next i

0
 

Author Comment

by:vmandem
Comment Utility
Hornett

The code works and thankyou for your constant support.

-VM

Comment to Dave:

Dave

I will definetly try your method and i'm very thankfull for your support too.

I really enjoy the knowledge transfer from you guys.

Once again thankyou all.

VM
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now