can anybody tell me why Bold statement is not working.

Private Sub Command2_Click()
Dim a As String
a = MsgBox("You want to Modify....?", vbQuestion + vbOKCancel, " MODIFY")
If a = vbOK Then
Set rs = New ADODB.Recordset
rs.CursorLocation = adUseClient
[B]rs.Open "select mr.srno,mr.productname,mr.qty, mr.unit from mrtemp as mr Order by mr.srno where mr.req_no=" & strlistrequest, con, adOpenDynamic, adLockOptimistic[/B]
If Not rs.EOF Then
Set Form6.DataGrid1.DataSource = rs
Form6.Show vbModeless
Else
MsgBox "Record not found"
End If
End If
End Sub

Recommended Answers

All 11 Replies

need to add & " after strlistrequest

now i add & ",now i am getting another error the connection cannot
be used to perform this operation. it is either closed or invalid in this
context.

rs.Open "select mr.srno,mr.productname,mr.qty, mr.unit from mrtemp as mr order by mr.srno where mr.req_no=" & strlistrequest & ", con, adOpenDynamic, adLockOptimistic"

is there an error number with that?

Yes sir, there is runtime error 3709.

try changing the query to

rs.Open "select srno, productname, qty, unit from mrtemp order by srno where req_no=" & strlistrequest & " order by srno", con, adOpenDynamic, adLockOptimistic

Now i replaced into these stat. But got syntax error.
error.doc

rs.Open "select srno, productname, qty, unit from mrtemp order by srno where req_no=" & strlistrequest & " order by srno", con, adOpenDynamic, adLockOptimistic

sorry about that take out the first order by srno and that should fix it

rs.Open "select srno, productname, qty, unit from mrtemp where req_no = " & strlistrequest & " order by srno", con, adOpenDynamic, adLockOptimistic

Actually i am from U.A.E i am making project currently on
procurement.can you tell me how shoud i edit and update data
grid information using update button.
Hints.doc

did this problem get solved? if so mark it as solved so if others run into a problem then can see the solution and create another thread for a different problem

Resolved.

you should see a button that says solved

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.