C
craignbaker
I would like to use the Seek function to find the details in a table and then
write it into a new record.
Private Sub ItemID_AfterUpdate()
Dim mydb As Database
Dim myset As Recordset
Dim ItemId As Integer
Dim CurrentPrice As Currency
Set mydb = CurrentDb()
'gets the value of the technicians name being sought
ItemId = InputBox("Enter the ItemID")
With rstItems
'Set the index."
myset.Index = "ItemID"
End With
'searches the recordset for the technician name inputted above
myset.Seek "=", [ItemId]
'if there is no match (the technician name is not found) then put up a
'messagebox
If myset.NoMatch Then
MsgBox ("ItemId not found")
Else
'open the form, go to the technician name field and find the record
specified 'above
[CurrentPrice] = myset!Price
Quantity.SetFocus
End If
End Sub
The problem comes up at setting the index. Any help would be appreciated.
Thankyou.
write it into a new record.
Private Sub ItemID_AfterUpdate()
Dim mydb As Database
Dim myset As Recordset
Dim ItemId As Integer
Dim CurrentPrice As Currency
Set mydb = CurrentDb()
'gets the value of the technicians name being sought
ItemId = InputBox("Enter the ItemID")
With rstItems
'Set the index."
myset.Index = "ItemID"
End With
'searches the recordset for the technician name inputted above
myset.Seek "=", [ItemId]
'if there is no match (the technician name is not found) then put up a
'messagebox
If myset.NoMatch Then
MsgBox ("ItemId not found")
Else
'open the form, go to the technician name field and find the record
specified 'above
[CurrentPrice] = myset!Price
Quantity.SetFocus
End If
End Sub
The problem comes up at setting the index. Any help would be appreciated.
Thankyou.