RE: Lookup



Change it to the following:

me.[national insurance number]=dlookup("[National Insurance number]","Staff",
"[member of staff] = '" & me.[member of staff] &"'")

In this example I assume that the controls on your form are actually called
[national insurance number] and [member of staff]. You have to place them
between square brackets because of the spaces in the controlname. Always best
practice to not use spaces in your fieldnames, now you know why. Have a go
and let me know if it works..

--
Maurice Ausum


"Khartoum" wrote:

Thanks for reply Maurice - here is what i wrote based on the fields but it
did not work - have i written it correctly cheers
me.national insurance number=dlookup('National Insurance number','Staff',
"member of staff = '" & me.member of staff &"'")

table is 'staff', fields on form are 'member of staff' and 'National
Insurance number'

"Maurice" wrote:

in the afterupdate of the username type something like this:

me.ninumber=dlookup('NInumber','Staff', "Username = '" & me.username & "'")

replace the fieldnames with your own fieldnames
note: first in dlookup is the field you are looking for
second in dlookup is tablename where to look
third in de dlookup is the wherestatement

After username= place single quote and double quotes
After me.username place double, single and double quotes again.

hth
--
Maurice Ausum


"Khartoum" wrote:

I have a form from a table - i have a field Staff name and a field National
Insurance Number on the form;
because it is linked directly to the table and not been created through a
query i want a way that when i input the user name the NI number
automatically populates-i do have a separate table Staff which contains the
staff name and NI number, can anybody tell me how to do it - i know it is as
a link criteria but do i need to do it as code or can i put it into
properties of ni field
Thanks John
.



Relevant Pages

  • RE: Lookup
    ... Sorry Maurice but i am getting a message now: ... me.national insurance number=dlookup('National Insurance number','Staff', ... second in dlookup is tablename where to look ... single and double quotes again. ...
    (microsoft.public.access.queries)
  • Re: Insurance question.. additional drivers?
    ... bring the insurance quote down, ... I yearn for the days when you could go or call a broker, tell him you are thinking of buying a car, after a few questions he looks in a book and can give you an estimate, armed with that knowledge you can decide to buy it or not. ... I'm currently buying another car, I've spent hours on websites entering minute trivia of my life over and over again and had quotes varying by several hundred pounds for the same set of questions, furthur it seems that many companies are in fact Brokers larger insurance companies, this is not necessarily made plain. ...
    (uk.rec.driving)
  • 4 Myths About Renters Insurance
    ... If you're wondering what's the big deal about renter's insurance -- ... unofficial online quotes from two major carriers produced ... included medical coverage for others, ... reimbursement is based on today's replacement cost rather than ...
    (misc.consumers)
  • Re: OT: Cage insurance question
    ... > You do realise, don't you, that Confused.com are not an insurance ... > broker, rather they're a free service that will take your details, ... Quotes from Hastings Direct themselves ...
    (uk.rec.motorcycles)
  • Re: Motorcycle insurance for a new rider has doubled
    ... I checked my cage insurance with confused.com, ... varying quotes, most startlingly including several from my then current ... The broker said he would see what he could do, ... named driver on my wife's Scooby Impreza! ...
    (uk.rec.motorcycles)