DLookup Function Problem

djwasim

Registered User.
Local time
Today, 20:56
Joined
May 29, 2009
Messages
93
hello

i am working on a project in which i have a form named "employee"
now i am facing a problem when i enter a token number in that form, the amount of monthly salary in a field named "monsalary" must b shown in the field named "salary" by default.

for instance:-

i am entering token number " 11 " the result is that the name of employee, father's name, employee status, employee's monthly salary, department, and type of employee are showing, but now i want to show employees monthly salary by default in the "salary" field using DLookup Function or any other


View attachment Dlookup Sample.zip

i have also attached the sample project.

plz help me if anyone can do?
 
Last edited:
It would be best you describe what problems you're experiencing with the DLookup before posting your db. What have you tried that isn't working?
 
i have not use dlookup function properly befor.
is there any other solution for this purpos?
 
now i use this formula in salary field default value property but i get no benefit

=DLookUp("[monsalary]","Employee Salary Q","[token] = " & [Forms]![Employee Salary]![token])

again i attach the sample db

View attachment Dlookup Sample.zip
 
The token field is numeric so you will need this expression =DLookUp("[monsalary]","Employee Salary Q","[token] = [Forms]![Employee Salary]![token]")

Lookup Help for more DLookup details
 
Or with Wasim's he could just add the single quotes:
Code:
=DLookUp("[monsalary]","Employee Salary Q","[token] = [COLOR=Red][B]'[/B][/COLOR]" & Forms![Employee Salary]![token] & "[COLOR=Red][B]'[/B][/COLOR]")
 
i have used above mentioned code but get no benefit :mad: :(
plzz help me anyone :(
 
i have used above mentioned code but get no benefit :mad: :(
plzz help me anyone :(

Where did you use the code?

Here is an updated version of your database, have a look at the default value of the salary field.
 

Attachments

hey dude
i think you have added an amount manually in salary field.
but i want to update salary field automatically with the amount of "monsalary" by default.

plz anyone other help me
 
Just had a look at your db. I don't see why you're referencing the form in your DLookup. This should work:
Code:
=DLookUp("[monsalary]","Employee Salary Q","[token] = " & [token])
 
again its not working :(

plz use this formula yourself in db sample. and upload it

i will b thankful to you :)
 
I think your proble mis tha tyou have two fields called token in your query. If you look at your query the token fields are not token but Employee.token and Transactions.token. You could try changing [token] to [Employee.token]

A more efficient way is to use a combo box with Employees table as the record source the and populate the fields from the record source. I have attached a sample database.

Open your form and select an employee from the drop down. After the employee is selected the fields highlighted are populated. The field token in the transaction table is bound to the hidden token field in the employee drop down.
 

Attachments

hey Poppa Smurf

thanks a lot to you

but your data base sample is not opening
can you send me again in zip file? then i will check it
 
thanx alot poppa smurf and all of you

its really useful for me
but i dont want to use this method of combo box. pleas anyone other help me?

or any other method there?
 
hello
the sample database you have sent me, is a really useful,
but the problem is that when i use it as a continues form then the field named "empfather", "empstatus", " monsalary" and " department" is show the same data for every record.
even it should have to show the data related to the field named "empname"
plz help me again.
 
When I change my layout from Single record to continuous I have no problems. If you are using unbound text boxes to display the employees details e.g. father, monthly salary etc then these will be the same for each record.

Please upload your database if you are not using unbound text boxes.
 

Users who are viewing this thread

Back
Top Bottom