Share via

How to use Dlookup in MS Access?

Feras Hmedan 0 Reputation points
2023-11-19T07:40:47.5066667+00:00

Here is the formula:

Me.txtpost = DLookup([Designation], [tblStaff], "EmployeeName=" & Me.txtname)

Me.txtpost: the field where I want to retrieve the data.

Designation: the data that I want to retrieve.

tblStaff: the tablke where the retrival data is stored.

EmployeeName = Me.txtbname: the creteria

Microsoft 365 and Office | Access | For business | Windows
0 comments No comments

1 answer

Sort by: Most helpful
  1. Vahid Ghafarpour 23,600 Reputation points
    2023-11-19T07:45:51.76+00:00

    Thanks for posting your question in the Microsoft Q&A forum.

    If Me.txtname is a text field, your code should be in this format:

    Me.txtpost = DLookup("Designation", "tblStaff", "EmployeeName='" & Me.txtname & "'")

    I hope it fix your request

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.