i need to make a purchase order and sales invoice to print in vb6. i used datareport. i already have a code that i can't get to work. i uploaded http://www.savefile.com/files/7624022

it gave me this error.

Run-time error '-2147217900(80040e14)':

Data shape command text contains a syntax error at or near position 114 in the command. The text near the error is: "Command2 RELATE) AS Command2".

when i clicked debug, it pointed me to the line

DataEnvironment1.Command1 (Combo1.Text)
this is the only thing left to do to finish my project. i really gotta make this work. hope you guys can help. thanks!

Dani AI

Generated

A common root cause for VB6 DataReport problems like this is a malformed SHAPE/CommandText string that the DataEnvironment builds at runtime. Comparing the working project that supplied to the original project that uploaded will usually show one small difference: a missing keyword, an extra/missing parenthesis, an ambiguous alias, or an unquoted value inserted from a form control. Finding that single mismatch is the quickest route to a fix.

Practical steps to isolate and fix the command string:

  • Reconstruct the full command into a local string variable and print it before execution so you can inspect the exact text that the provider receives.
  • Validate the SHAPE structure: root SELECT in braces, an APPEND clause with child SELECT(s) inside parentheses, a RELATE clause with matching column names, and an AS alias for the child recordset.
  • Bracket any table/field names with spaces or reserved words, and make sure values concatenated from controls are properly quoted or escaped.
  • Test each SELECT on its own first, then add the APPEND/RELATE piece. Also confirm the OLE DB provider in use supports ADO Data Shaping.

Example technique (inspect before run):

Dim shp As String
shp = "SHAPE {SELECT * FROM Customers} APPEND ({SELECT * FROM Orders} RELATE CustomerID TO CustomerID) AS Orders"
Debug.Print shp    'verify exact text in Immediate window

If shaping remains fragile, build a flattened recordset with a single JOIN or create and populate an ADODB.Recordset in code and bind that to the report. Comparing the working project line-by-line will reveal the exact syntactic change that fixed the problem.

Recommended Answers

All 2 Replies

Hi,

I am attaching the zip file contaning the modified version of your project. It now shows the Report with the Data. I guess this is what you did like to see.


Marikanna


---------------------------------------------------------------------
Success is a Journey, not a Destination

hi, thanks for the modified program!! it's working! thank you so much!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.