3 Replies - 2474 Views - Last Post: 19 September 2009 - 07:26 AM Rate Topic: -----

#1 marxman89  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 33
  • Joined: 09-July 09

is it possible to merge cells in datagrid?(like in excel)

Post icon  Posted 17 September 2009 - 01:23 PM

i want to make a merged cell in order to put a header.
see my code below.




Private Sub btnAddToReport_Click()
Call connectdb

Dim query0, query, query1, query2, query3, query4, query5, query6, query7, query8 As String
If MsgBox("Are you sure you want this to be added to report?", vbInformation + vbYesNo, "Report") = vbYes Then
query0 = "INSERT INTO Reports(RawMaterials, Quantity, CostQuantity, Cost) VALUES ('', ' ', '', '' )"
query0 = "INSERT INTO Reports(RawMaterials, Quantity, CostQuantity, Cost) VALUES ('', ' ', '', '' )"
query1 = "INSERT INTO Reports(RawMaterials, Quantity, CostQuantity, Cost) VALUES ('Flat bar(1pc/10 ft)', '" & Me.txtQuantity1.Text & "', '" & Me.txtCostQuantity1.Text & "', '" & Me.txtCost1.Text & "' )"
query2 = "INSERT INTO Reports(RawMaterials, Quantity, CostQuantity, Cost) VALUES ('Nitric Acid(ml)','" & Me.txtQuantity2.Text & "', '" & Me.txtCostQuantity2.Text & "', '" & Me.txtCost2.Text & "' )"
query3 = "INSERT INTO Reports(RawMaterials, Quantity, CostQuantity, Cost) VALUES ('Hydrochloric Acid (ml)','" & Me.txtQuantity3.Text & "', '" & Me.txtCostQuantity3.Text & "', '" & Me.txtCost3.Text & "' )"
query4 = "INSERT INTO Reports(RawMaterials, Quantity, CostQuantity, Cost) VALUES ('Pure gold (g)','" & Me.txtQuantity4.Text & "', '" & Me.txtCostQuantity4.Text & "', '" & Me.txtCost4.Text & "' )"
query5 = "INSERT INTO Reports(RawMaterials, Quantity, CostQuantity, Cost) VALUES ('Nickel (g)','" & Me.txtQuantity5.Text & "', '" & Me.txtCostQuantity5.Text & "', '" & Me.txtCost5.Text & "' )"
query6 = "INSERT INTO Reports(RawMaterials, Quantity, CostQuantity, Cost) VALUES ('Silver cyanide (ml)','" & Me.txtQuantity6.Text & "', '" & Me.txtCostQuantity6.Text & "', '" & Me.txtCost6.Text & "' )"
query7 = "INSERT INTO Reports(RawMaterials, Quantity, CostQuantity, Cost) VALUES ('Sodium cyanide (ml)','" & Me.txtQuantity7.Text & "', '" & Me.txtCostQuantity7.Text & "', '" & Me.txtCost7.Text & "' )"
query8 = "INSERT INTO Reports(RawMaterials, Quantity, CostQuantity, Cost) VALUES ('Sosa (ml)','" & Me.txtQuantity8.Text & "', '" & Me.txtCostQuantity8.Text & "', '" & Me.txtCost8.Text & "' )"
db.Execute (query0)
db.Execute (query0)
db.Execute (query1)
db.Execute (query2)
db.Execute (query3)
db.Execute (query4)
db.Execute (query5)
db.Execute (query6)
db.Execute (query7)
db.Execute (query8)


db.Close
Me.AdodcReports.Refresh
End If


End Sub


notice
query0 = "INSERT INTO Reports(RawMaterials, Quantity, CostQuantity, Cost) VALUES ('', ' ', '', '' )"
query0 = "INSERT INTO Reports(RawMaterials, Quantity, CostQuantity, Cost) VALUES ('', ' ', '', '' )"



as you can see, i use the command insert into to make an empty row however aside from making an empty row i also want to merge those cells.

Is This A Good Question/Topic? 0
  • +

Replies To: is it possible to merge cells in datagrid?(like in excel)

#2 thava  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 180
  • View blog
  • Posts: 1,606
  • Joined: 17-April 07

Re: is it possible to merge cells in datagrid?(like in excel)

Posted 17 September 2009 - 06:37 PM

may i know what is the need for merged cells
Was This Post Helpful? 0
  • +
  • -

#3 marxman89  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 33
  • Joined: 09-July 09

Re: is it possible to merge cells in datagrid?(like in excel)

Posted 18 September 2009 - 10:30 PM

View Postthava, on 17 Sep, 2009 - 05:37 PM, said:

may i know what is the need for merged cells



i wanna make a heading that's y i need to merge cells. others suggest that using ms flex would solve my problem, however as much as possible i wanna use just a datagrid.
Was This Post Helpful? 0
  • +
  • -

#4 thava  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 180
  • View blog
  • Posts: 1,606
  • Joined: 17-April 07

Re: is it possible to merge cells in datagrid?(like in excel)

Posted 19 September 2009 - 07:26 AM

i can also suggest the same thing for you because the datagrid is designed for enter data in a tabular manner not for presentation purposes hope you understand

This post has been edited by thava: 19 September 2009 - 07:27 AM

Was This Post Helpful? 1
  • +
  • -

Page 1 of 1