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

Access
Access
A family of Microsoft relational database management systems designed for ease of use.
340 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Vahid Ghafarpour 20,490 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