run a query on lost focus

  • Thread starter Thread starter Karen
  • Start date Start date
K

Karen

I am working on a data entry form where i don't want to allow a user to
enter a record with the same code and lotno as an existing record. There
can be other codes with the same lotno, there can be many lotno's for each
code.

I had in mind to run a query when the lotno field lost focus and alert the
user if there was an existing record with the same code+lotno combination.
When they click an ok button, focus should be set to the lotno field.
If there isn't a match I want the entry to continue with no alerts or
notices.

Does anyone have any ideas on how to do this?

Thanks in advance for all of your help.

Karen
 
Why don't you handle this at the table level by making a combined key of
Code and LotNo and allow duplicates=no?


I am working on a data entry form where i don't want to allow a user to
enter a record with the same code and lotno as an existing record. There
can be other codes with the same lotno, there can be many lotno's for each
code.

I had in mind to run a query when the lotno field lost focus and alert the
user if there was an existing record with the same code+lotno combination.
When they click an ok button, focus should be set to the lotno field.
If there isn't a match I want the entry to continue with no alerts or
notices.

Does anyone have any ideas on how to do this?

Thanks in advance for all of your help.

Karen
 
Because i wasn't aware i could make combined key's. I'm learning about all
those little things as I go.

I'll have to check that out...

Thanks Rick
 
Cool. Use the help feature. It explains how it is done. Basically, hold
down CTRL while selecting your rows, then click the 'key' button.

Hope that helps.

Rick B

Because i wasn't aware i could make combined key's. I'm learning about all
those little things as I go.

I'll have to check that out...

Thanks Rick
 
I got the combined key thing going. How can I change the message that comes
up. It's not user friendly and will scare the users half to death. I
simply want to say "The lot number you have entered already exists for this
code. Please reenter the lot number."

And... Can I set the focus to lotno when the message is closed?
 
Karen:

I am not real good at handling error messages. Why don't you post a new
thread and explain what you would like to do with the error. I think you
can have it grab that error, display a new message, then set the focus.

Sorry I could not be of more help.

Rick B


I got the combined key thing going. How can I change the message that comes
up. It's not user friendly and will scare the users half to death. I
simply want to say "The lot number you have entered already exists for this
code. Please reenter the lot number."

And... Can I set the focus to lotno when the message is closed?
 
Back
Top