campbellhatchard
Technical User
I am creating a database to maintain stock volumes in a warehouse. In my Database I have a Table called Stock. Within this table I have two fields [OrderNo} which is a number field and is also the primary key and a second field called [StyleNo} which is a text field.
In one or the forms in which you enter despatch details I hace both these fields as entry fields. For ease of entry I have tried to set a "On Exit" event procedure set against the [OrderNo] field to autofill the [StyleNo] field.
The following is the event in VB
Private Sub Order_No_Exit(Cancel As Integer)
Dim varStyleNo As Variant
varStyleNo = DLookup("StyleNo", "Stock", "OrderNo = [OrderNo]"
If (Not IsNull(varStyleNo)) Then Me![StyleNo] = varStyleNo
End Sub
When the event is run I come up with the following error
Run-Time error '2465': Microsoft Access can't find the field 'StyleNo' referred to in your expression
When I go into debug, the exp. Me![StyleNo]=varStyleNo is highlighted in yellow.
I know I am probably looking straight at the problem but cant see the wood for the tree's.
Any assistance will be greatly appreciated. I am betting this will be the first of a few queries in relation to this project
In one or the forms in which you enter despatch details I hace both these fields as entry fields. For ease of entry I have tried to set a "On Exit" event procedure set against the [OrderNo] field to autofill the [StyleNo] field.
The following is the event in VB
Private Sub Order_No_Exit(Cancel As Integer)
Dim varStyleNo As Variant
varStyleNo = DLookup("StyleNo", "Stock", "OrderNo = [OrderNo]"
If (Not IsNull(varStyleNo)) Then Me![StyleNo] = varStyleNo
End Sub
When the event is run I come up with the following error
Run-Time error '2465': Microsoft Access can't find the field 'StyleNo' referred to in your expression
When I go into debug, the exp. Me![StyleNo]=varStyleNo is highlighted in yellow.
I know I am probably looking straight at the problem but cant see the wood for the tree's.
Any assistance will be greatly appreciated. I am betting this will be the first of a few queries in relation to this project