LarryDeLaruelle
Technical User
THE SITUATION: I have a supplemental database which records and reports information on new admissions. Records are identified by a primary key “ClientID” and a secondary (indexed, duplicates allowed) “BillingID”. ClientID is an Autonumber field used as the main linking field between tables and is "behind the scenes" -- users would not know what a client's ClientID is.<br><br>The source documents, because of confidentiallity, are identified only by the BillingID and Completion Date (which usually is on or close to the Admission Date). I am retrieving the ClientID and other identifier information from the main database based on the BillingID.<br><br>Clients can have multiple admissions each of which generates a unique ClientID but the BillingID is reused.<br><br>THE PROBLEM: Because the BillingID is the field used in the SQL statement to retrieve the relevant information, I need a way for the user to associate the correct ClientID (based on the Admission Date being equal to or near the Completion Date of the source document) where a client has more than one admission. <br><br>What I would like to do, unless you have another approach, is to display a message indicating that multiple records exist on the BillingID and a list of Admission Dates and prompt the user to select the appropriate date. I could then set the pointer to the correct record to retrieve the information I need.<br><br>Here is my current code:<br><br>Private Sub txtOakLawnNum_AfterUpdate() ‘Oaklawn Number is the BillingID<br>On Error GoTo err_txtOaklawnNum_afterupdate<br><br> Dim dbcurrent As Database<br> Dim rsTemp As Recordset<br> Dim strSQL As String<br> Dim strOak As String<br><br> strOak = txtOaklawnNum<br><br> Set dbcurrent = CurrentDb()<br> strSQL = "SELECT ClientID, OaklawnNum, FullName, AdmissionDate " _<br> & "FROM client " _<br> & "WHERE OaklawnNum = '" & strOak & "';"<br> Set rsTemp = dbcurrent.OpenRecordset(strSQL)<br> rsTemp.MoveLast<br> rsTemp.MoveFirst<br><br>HERE IS WHERE I NEED SOME CODE:<br><br> If rsTemp.RecordCount > 1 then<br><br> Display some message to the user<br> Prompt the user for record Selection<br><br> End IF<br><br>THEN I WOULD SET THE RECORD POINTER BASED ON THE SELECTION<br><br> txtFullName = rsTemp.Fields(2)<br> txtAdmissionDate = rsTemp.Fields(3)<br> ClientID = rsTemp.Fields(0)<br> <br> rsTemp.Close<br><br>Is there a way to display a recordset in this type of situation to allow the user to make a selection?<br><br>Is there a better way to accomplish what I am trying to do?<br><br>Thanks much.<br> <p>Larry De Laruelle<br><a href=mailto:larry1de@yahoo.com>larry1de@yahoo.com</a><br><a href= > </a><br>