I want if user click on save all the data should store on the MR table
but it is not storing.

Private Sub Command1_Click()
' Debug.Assert False
On Error GoTo cancel
Set rs1 = New Recordset
rs1.Open " SELECT * FROM MR ", con, adOpenDynamic, adLockOptimistic
' rs1.Open " SELECT * FROM MR WHERE Grd.Col = '" & Grd.TextMatrix(Grd.Row, cItemCode) & "' ", con, adOpenDynamic, adLockBatchOptimistic
rs1.AddNew
rs1.Fields(1) = Combo1.Text
rs1.Fields(2) = Text1.Text
rs1.Fields(3) = Text2.Text
rs1.Fields(4) = Text3.Text
rs1.Fields(5) = Text4.Text
rs1.Fields(6) = DTPicker2.Value
rs1.Fields(7) = CStr(Text6.Text)
rs1.Fields(8) = Text7.Text
rs1.Fields(9) = DTPicker1.Value
rs1.Fields(10) = Text13.Text
rs1.Fields("qty") = FlexGridEditor.Value
rs1.Fields("Product_name") = Grd.TextMatrix(Grd.Row, cItemName) & vbNullString
rs1!ProductName = Grd.TextMatrix(Grd.Row, cItemName) & vbNullString
rs1.Update
MsgBox ("Commit")
rs1.Close
done:
Exit Sub
cancel:
MsgBox Err.Number
MsgBox Err.Description
Resume done
End Sub

This thread should have been in Visual Basic 4/5/6 section of the forum.

Kindly send your rediff or gmail or anyother email_id sothat
i send myusercontrol,po.frn,.bas,.cls file on your email_id
many time i have given a explanation
there is no any other additional option .
i am waiting for your prompt reponse

and I have posted this thread In Visual basic 4/5/6.

Why you are not sending reply.

I want if user click on save it should be save using save button
But Mshflexgrid data is not saving :

Private Sub Command1_Click()

' Debug.Assert False
On Error GoTo cancel
Set rs1 = New Recordset
rs1.Open " SELECT * FROM MR ", con, adOpenDynamic, adLockOptimistic
' rs1.Open " SELECT * FROM MR WHERE Product_id = '" & Grd.TextMatrix(Grd.Row, cItemCode) & "' ", con, adOpenDynamic, adLockOptimistic
rs1.AddNew
rs1.Fields(1) = Combo1.Text
rs1.Fields(2) = Text1.Text
rs1.Fields(3) = Text2.Text
rs1.Fields(4) = Text3.Text
rs1.Fields(5) = Text4.Text
rs1.Fields(6) = DTPicker2.Value
rs1.Fields(7) = CStr(Text6.Text)
rs1.Fields(8) = Text7.Text
rs1.Fields(9) = DTPicker1.Value
rs1.Fields(10) = Text13.Text
rs1.Fields("qty") = FlexGridEditor.Value
rs1.Fields("Product_id") = Grd.TextMatrix(Grd.Row, cItemCode)
rs1!ProductName = Grd.TextMatrix(Grd.Row, cItemName) & vbNullString
rs1.Fields("maxofunit") = Grd.TextMatrix(Grd.Row, cUnit) & vbNullString
rs1.Update
MsgBox ("Commit")
rs1.Close

done:
Exit Sub

cancel:
MsgBox Err.Number
MsgBox Err.Description
Resume done
End Sub

Kindly help it is urgent.

Sorry ,
Actually i was new that is why i forget these things
next time carefully i post these question.

I want if user click on save button all the Mshflex grid cell data store
In Mr table :
I have writtn some code in save button :

Private Sub Command1_Click()
Dim nm As String
' Debug.Assert False
On Error GoTo err
Set rs1 = New Recordset
rs1.Open " SELECT * FROM MR ", con, adOpenDynamic, adLockOptimistic
' rs1.Open " SELECT * FROM MR WHERE Product_id = '" & Grd.TextMatrix(Grd.Row, cItemCode) & "' ", con, adOpenDynamic, adLockOptimistic
rs1.AddNew
rs1.Fields(1) = Combo1.Text
rs1.Fields(2) = Text1.Text
rs1.Fields(3) = Text2.Text
rs1.Fields(4) = Text3.Text
rs1.Fields(5) = Text4.Text
rs1.Fields(6) = DTPicker2.Value
rs1.Fields(7) = CStr(Text6.Text)
rs1.Fields(8) = Text7.Text
rs1.Fields(9) = DTPicker1.Value
rs1.Fields(10) = Text13.Text
rs1.Fields("qty") = FlexGridEditor.Value
' rs1.Update rs1.Fields.Item(fldProductName).Value = Trim(Grd.TextMatrix(Grd.Row, cItemName) & "")
rs1.Fields("item_code").Value = Trim(Grd.TextMatrix(Grd.Row, Grd.AddItem) & " ")
rs1!ProductName = Trim(Grd.TextMatrix(Grd.Row, cItemName) & "")
rs1.Fields("maxofunit") = Trim(Grd.TextMatrix(Grd.Row, cUnit) & "")
MsgBox ("Commit")
rs1.Close
Exit Sub
err: MsgBox "Error in Command1_Click()" & vbCrLf & err.Number & vbCrLf & err.Description

End Sub

all the line which is bold not working properly
since this issue is time bounded if you kindly
help me i will remain grateful.

I want if user click on save button all the Mshflex grid cell data store
In Mr table :
I have writtn some code in save button :

Private Sub Command1_Click()
Dim nm As String
' Debug.Assert False
On Error GoTo err
Set rs1 = New Recordset
rs1.Open " SELECT * FROM MR ", con, adOpenDynamic, adLockOptimistic
' rs1.Open " SELECT * FROM MR WHERE Product_id = '" & Grd.TextMatrix(Grd.Row, cItemCode) & "' ", con, adOpenDynamic, adLockOptimistic
rs1.AddNew
rs1.Fields(1) = Combo1.Text
rs1.Fields(2) = Text1.Text
rs1.Fields(3) = Text2.Text
rs1.Fields(4) = Text3.Text
rs1.Fields(5) = Text4.Text
rs1.Fields(6) = DTPicker2.Value
rs1.Fields(7) = CStr(Text6.Text)
rs1.Fields(8) = Text7.Text
rs1.Fields(9) = DTPicker1.Value
rs1.Fields(10) = Text13.Text
rs1.Fields("qty") = FlexGridEditor.Value
' rs1.Update rs1.Fields.Item(fldProductName).Value = Trim(Grd.TextMatrix(Grd.Row, cItemName) & "")
rs1.Fields("item_code").Value = Trim(Grd.TextMatrix(Grd.Row, Grd.AddItem) & " ")
rs1!ProductName = Trim(Grd.TextMatrix(Grd.Row, cItemName) & "")
rs1.Fields("maxofunit") = Trim(Grd.TextMatrix(Grd.Row, cUnit) & "")
MsgBox ("Commit")
rs1.Close
Exit Sub
err: MsgBox "Error in Command1_Click()" & vbCrLf & err.Number & vbCrLf & err.Description

End Sub

all the line which is bold not working properly
since this issue is time bounded if you kindly
help me i will remain grateful.

Wrong use of Grd.AddItem() and what about cItemName and cUnit

I Want if user click on save data all data should be store in MR Table.
Private Sub Command1_Click()
'On Error Resume Next
Dim nm As String
' Debug.Assert False
' On Error GoTo err
Set rs1 = New Recordset
rs1.Open " SELECT * FROM MR ", con, adOpenDynamic, adLockOptimistic
rs1.AddNew
rs1.Fields(1) = Combo1.Text
rs1.Fields("job_no") = Text1.Text
rs1.Fields("cost_centre") = Text2.Text
rs1.Fields("emp_name") = Text3.Text
rs1.Fields("del_point") = Text4.Text
rs1.Fields("del_time") = Text6.Text
rs1.Fields("del_date") = DTPicker2.Value
rs1.Fields("sug_vendor") = Text7.Text
rs1.Fields("mr_date") = DTPicker1.Value
rs1.Fields("manager") = Text13.Text
rs1.Fields("qty") = FlexGridEditor.Value
' rs1.Fields.Item(fldProductName).Value = Trim(Grd.TextMatrix(Grd.Row, Grd.Col) & "")
rs1.Fields("item_code").Value = Trim(Grd.TextMatrix(Grd.Row, cItemCode) & " ")
rs1!ProductName = Trim(Grd.TextMatrix(Grd.Row, cItemName) & "")
rs1.Fields("maxofunit") = Trim(Grd.TextMatrix(Grd.Row, Grd.Col) & "")
rs1.Update
MsgBox Trim(Grd.TextMatrix(Grd.Row, Grd.Col) & "")
MsgBox ("Commit")
rs1.Close
Exit Sub
'err: MsgBox "Error in Command1_Click()" & vbCrLf & err.Number & vbCrLf & err.Description
End Sub

but Bold statement is not storing information from grid which is actually Mshflexgrid control Kindly find assignment.zip folder see PO.FRM
Kindly send reply it is urgent i will remain grateful to you

rs1.Fields("item_code").Value = Trim(Grd.TextMatrix(Grd.Row, cItemCode) & " ")
rs1!ProductName = Trim(Grd.TextMatrix(Grd.Row, cItemName) & "")
rs1.Fields("maxofunit") = Trim(Grd.TextMatrix(Grd.Row, Grd.Col) & "") rs1.Update

Hmm.. You sure the second line (ie: rs1!.) is supposed to have the !?

rs1.Fields("item_code").Value = Trim(Grd.TextMatrix(Grd.Row, cItemCode) & " ")
rs1!ProductName = Trim(Grd.TextMatrix(Grd.Row, cItemName) & "")
rs1.Fields("maxofunit") = Trim(Grd.TextMatrix(Grd.Row, Grd.Col) & "") rs1.Update

Hmm.. You sure the second line (ie: rs1!.) is supposed to have the !?

Sir
rs1.Fields("item_code").Value = Trim(Grd.TextMatrix(Grd.Row, cItemCode) & " ")
When i put this line get error item cannot be found in the collection
corresponding to requested name or ordinal.

Hi,
Check the fields (item_code, ProductName and maxofunit) are available and spelled correctly ..

Hi,
Check the fields (item_code, ProductName and maxofunit) are available and spelled correctly ..

these are spelled correctly.

Five duplicate threads merged.

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.