Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

trouble with subforms and querys...

Status
Not open for further replies.

OIE

Programmer
Jan 2, 2004
4
GB
Hi, im in the not-so-enviable task of having just slightly more knowledge of access than my co-workers and so being picked to create the companies training database.
I've set up all the tables and a few of the forms but my problem is this:

I have a main form from which the user inputs the details of any particular training course, and then a subform which is used to enter the names and details of the employees who went on that course. (the actual employee details are already in a table but I need this set up to link which people went on which course.)

So far so good, as long as ALL the information in the subform is put in by hand. The problem is that I want to simply type in the name of the employee on the subform and the rest of his details to be automatically filled in.

I've achieved this in a standalone form by using querys that relate to the 'txtname' box as the input. They then find the relevant employees details from the employee table and voila.

However, when using this form as the subform, the querys don’t wait for me to get to the txtname box! As soon as I open the form a message pops up asking for the name of employee (which should be taken from the value of txtname when I get there)

Sorry if the above is a little muddled, im really not that good with all of this. Basically I’d like to know why my querys aren't waiting for me to get to the relevant box in the subform.

Any help would be much appreciated, thanks.
 
from another beginner... change the tabindex (on the "other" section in properties of the field on the form) on the txtname box to "0". Any other fields should be set higher than "0", or if you don't want the field tabbed through, change its tabstop to "no".
 
hi again

just tried changing the tabindex and it made no differnce, as soon as i doubble click on the form to open it, a message box still appears asking me for the name :(
 
are you prompting for the txtname in the query?
 
i think so yes. In the criteria box of the query i have the following:

[Forms]![FRM Training event]![txtname]

when the form using that query (frm training event) is opened on its own, no messages appear and the relevant fields are updated when i enter a value into the text box. When i have this in a subform, the prompt comes up straight away. It just doesnt seem to wait.
 
I am afraid I am not much help, as this is similar to the very problem I am having today. However, I have had problems like this before, and I remember that I had created some redundancies in prompting for keyboard input by using "[]" in both forms and queries. I also have found such problems when my variable names don't match exactly.
 
this is the same as the problem I am having today. Remove the "[Forms..." from the criteria in the query and try it.

If that doesn't work, try it without the "s" in "Forms".
 
just tried it with only [txtname] in the criteria and, so far, It Works!

Thank you very much for your help, i doubt very much that i would have come up with something so deceptively simple and yet important on my own.

seriously, thankyou :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top