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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hi, I have a group of typists who type for different hospitals. So

Status
Not open for further replies.

ThornPCC

Programmer
Jan 6, 2000
26
0
0
US
Hi,<br>
<br>
I have a group of typists who type for different hospitals. Some typists work for more than one hospital.<br>
When our payroll clerk enters the number of reports typed by each typist I want to be able either limit the combo box of hospitals to that specific typist, or list all the hospitals.<br>
<br>
I have 3 main tables, Billing, Hospitals, & Typists.<br>
Here are the general layouts of each.<br>
<br>
Table Fields<br>
<br>
Typists TL Number (unique index), Name (Last,First)<br>
<br>
Hospitals Hospital (unique index), TLs (multiple typists)<br>
<br>
Billing Date, TL Number, Name, Hospital, Pages, Studies<br>
<br>
I'm thinking of putting a yes/no field for limit to list. That way we can set the typists that we want to be limited to the list. <br>
<br>
The part I'm stuck on is the logice behind the form for this. Any suggestions will be helpful.<br>
<br>
Thanks<br>
<br>
<p>Phil<br><a href=mailto:Thorn@full-moon.com>Thorn@full-moon.com</a><br><a href= > </a><br>Most of us go through life not knowing what we want, but feeling damned sure that this isn't it.<br>

 
If you want to limit a list based on a field on your form than you need a relationship between the Hospitals and Typists. <br>
First NEVER put both First name and Last name in the same field.<br>
Second put a Combo box on your form that's &quot;Row source&quot; will limit the list.<br>
So if you are keying something in Text1 then the SQL statement looks like this<br>
SELECT Hospital.ID, Hospital.Name FROM Hospital WHERE (((Hospital.ID)=[Forms]![Form1]![Text1])); <br>
<br>
Next put this code in Text1's After Update event<br>
Private Sub Text1_AfterUpdate()<br>
Combo5.Requery '&lt; This refreshes the Combo box<br>
End Sub<br>
<br>
So when you finish typing in something in Text1 then Combo5 will limit the list.<br>
Now I may not have the fields you need in the correct place, but this is the general Idea. <br>
<br>
<p> DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br>
 
Doug,<br>
<br>
That's along the lines of what I need. I have to have the Both names in the same field as this is a legacy database converted to Access. I may eventually get around to changing the fields, but that is another project.<br>
<br>
What I need to do is search for one of multiple TL#'s that are in one field. example; <br>
Hospital = &quot;Abington Memorial&quot;<br>
TL =&quot;100, 103, 189&quot;<br>
<br>
I need to find the &quot;103&quot; and limit the Hospital Combo baox to Hospitals with &quot;103&quot; in the TL field.<br>
I could try to run a query to create a table with multiple hospitals and one tl in each record. That might make it easier, but give me a larger database.<br>
<br>
The database is already 2.2 megs and it's only the middle of Feb.<br>
<br>
Thanks <p>Phil<br><a href=mailto:Thorn@full-moon.com>Thorn@full-moon.com</a><br><a href= > </a><br>Most of us go through life not knowing what we want, but feeling damned sure that this isn't it.<br>

 
Well to find a string within a string use &quot;INSTR&quot; function<br>
<br>
What criteria are you using to know which hospital to pick out of the list. In Other words<br>
If Hospital = &quot;Abington Memorial&quot; then how do you know you want 103 out of TL =&quot;100, 103, 189&quot;<br>
Is &quot;Abington Memorial&quot; in fact TL &quot;103&quot;?<br>
<br>
Thats where you put the INSTR function.<br>
here is an example not sure it its exactly what you want.<br>
<br>
Value = INSTR(1,MyTextBox,&quot;103&quot;)<br>
the your SQL satement in the Combo box uses Value in it<br>
<br>
SELECT Hospital.ID, Hospital.Name FROM Hospital WHERE (((Hospital.ID)= &quot; & Value & &quot;));&quot;<br>
<br>
Something like that.... <br>
<br>
<br>
<br>
<br>
<p> DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br>
 
You're asking for trouble if you create functionality for a database before you normalize it. Not only do you need to make the fields atomic (break down name and break down typists), the Hospital table structure is incorrect. The hospital table should have just hospital ID and related items. To relate Hospitals to Typists, you need an additional table HospitalTypists with one Hospital ID and one TypistID per record. <br>
<br>
<br>
<br>

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top