Ahmed Fawad
Board Regular
- Joined
- Mar 1, 2011
- Messages
- 63
- Office Version
- 2016
- Platform
- Windows
I've got a Sales Invoice form, I want to take all details when I enter an old invoice number, I know it's very plain n simple but the error it's showing I'm not getting it resolved. Form n VBA code is there.
Same code I'm using on Vehicle reg. # to get all the details if already in the record, it's working perfectly.
The error is "Unable to get the VLookup property of the WorksheetFunction class"
If invoice # doesn't exist, it'll go for a new record, but if it does, it'll show the relative records in related fields.
Please advise...
TIA
Same code I'm using on Vehicle reg. # to get all the details if already in the record, it's working perfectly.
The error is "Unable to get the VLookup property of the WorksheetFunction class"
If invoice # doesn't exist, it'll go for a new record, but if it does, it'll show the relative records in related fields.
VBA Code:
Private Sub txtinv_AfterUpdate()
With Me
cmbsflock = Application.WorksheetFunction.VLookup(Me.txtinv, Worksheets("SALES").Range("B:K"), 2, 0)
txtsdate = Application.WorksheetFunction.VLookup(Me.txtinv, Worksheets("SALES").Range("B:K"), 3, 0)
txtvreg = Application.WorksheetFunction.VLookup(Me.txtinv, Worksheets("SALES").Range("B:K"), 4, 0)
txtdname = Application.WorksheetFunction.VLookup(Me.txtvreg, Worksheets("SALES").Range("B:K"), 5, 0)
txtmob = Application.WorksheetFunction.VLookup(Me.txtinv, Worksheets("SALES").Range("B:K"), 6, 0)
txtpartyn = Application.WorksheetFunction.VLookup(Me.txtinv, Worksheets("SALES").Range("B:K"), 7, 0)
txtdealern = Application.WorksheetFunction.VLookup(Me.txtinv, Worksheets("SALES").Range("B:K"), 8, 0)
txt1w = Application.WorksheetFunction.VLookup(Me.txtinv, Worksheets("SALES").Range("B:K"), 9, 0)
txt2w = Application.WorksheetFunction.VLookup(Me.txtinv, Worksheets("SALES").Range("B:K"), 10, 0)
End With
End Sub
Please advise...
TIA