Need help with Sales invoice

Ahmed Fawad

Board Regular
Joined
Mar 1, 2011
Messages
63
Office Version
  1. 2016
Platform
  1. 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"

1629413698395.png



Code is
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

Ahmed
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Are there any empty cells in the vlookup range by chance?

By the way, code is inside "With Me" but no reference to it otherwise. Are the variables (left part) control names?
 
Upvote 0
Are there any empty cells in the vlookup range by chance?

By the way, code is inside "With Me" but no reference to it otherwise. Are the variables (left part) control names?
Thanks for the replay, yes some empty cells are there.
 
Upvote 0

Forum statistics

Threads
1,216,085
Messages
6,128,733
Members
449,465
Latest member
TAKLAM

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top