can anybody tell me .How should i store Requistion Nos In MaterialRequisitionorder table and Material Requistion Detail table.
Here is the code what i have wriiten.Why it is breaking on the bold line. i am getting error item cannot be found in the collection corresponding to the requested name or ordinal.
Private Sub Command1_Click()
If (CheckInput) Then
End If
' On Error GoTo cancel
Dim row As Integer
Set rs = New ADODB.Recordset
' rs.Open " SELECT * FROM mrtemp ", con, adOpenDynamic, adLockOptimistic
rs.Open "select * from MaterialRequisitionOrder as p inner join MaterialRequisitionDetail as e on e.requsition_no=p.requsition_no", con, adOpenDynamic, adLockOptimistic
For row = 1 To Grd.Rows
' we test before we start to add a new Record
If Grd.TextMatrix(CLng(row), 1) = "" Then
' we only leave the loop !
Exit For
End If
rs.AddNew
rs.Fields("Dept_name") = Combo1.Text
rs.Fields("job_no") = Text1.Text
rs.Fields("Dept_id") = CLng(Text2.Text)
rs.Fields("emp_name") = Text3.Text
rs.Fields("delivery_point") = Text4.Text
rs.Fields("delivery_time") = CStr(MaskEdBox1)
rs.Fields("delivery_date") = DTPicker2.Value
' rs.Fields("sug_vendor") = Text7.Text
rs.Fields("materialreq_date") = DTPicker1.Value
' rs.Fields("manager") = Text13.Text
[B]rs.Fields("requsition_no") = Text12.Text[/B]
' rs.Fields("srno") = Grd.TextMatrix(CLng(row), 0)
rs.Fields("Material_id") = Grd.TextMatrix(CLng(row), 1)
rs.Fields("Material_name") = Grd.TextMatrix(CLng(row), 2)
rs.Fields("unit") = Grd.TextMatrix(CLng(row), 3)
rs.Fields("Quantity") = Grd.TextMatrix(CLng(row), 4)
' If rs.Fields("Item_code") = "" Then
' Exit For
' Exit Sub
' End If
' MsgBox Trim(Grd.TextMatrix(1, 1))
MsgBox "Commit", vbInformation, Me.Name
rs.Update
Next
rs.Close
'cancel: MsgBox "Error in Command1_Click()" & vbCrLf & Err.Number & vbCrLf & Err.Description
End Sub