FindRecord problem

M

Mick

Hi All

Have two forms, stock and order. When the user selects from a Lookup
wizard StockID (based on a field in Stock table) I need it to open
Stock table at right record so ammendments can be made.

Code is:
Private Sub StockID_Exit(Cancel As Integer)
'this stock ID is on the order form
Dim findstocknumber As Long


StockID = findstocknumber
DoCmd.OpenForm "frmStock"
StockID.SetFocus
DoCmd.FindRecord findstocknumber

Forms![frmOrder].SetFocus
End Sub

When I use an entry from Stock ID such as "crisps" as the argument for
DoCmd.FindRecord it works fine, but can't use the variable
findstocknumber instead.

Can't believe I'm stuck on such a simple thing, but there you go.

Any help appreciated

Mick
 
O

Ofer

I cant see in your code where you assign a value to the findstocknumber
variable, so on what value do you want to search on?
 
M

Mick

Hi Ofer

Was trying to use the drop down on Order as findstocknumber but am
beginning to think the problem is in a lookup wizard that I used from
Stock that brought the PK with it - think it is searching for that.

Thanks a lot for the help

Mick
 
Top