Sub Form returns wrong data

aian

Registered User.
Local time
Today, 23:50
Joined
Jan 28, 2005
Messages
70
Hi to all!

I have a pretty complex problem with a form and a subform and I really can't think what to do...

First of all, the main form keeps appointments. The screenshot form1.jpg shows the main form with an appointment from the client named KAPEZA TATIANA (not a real person ;o) ), the employee who will be responsible of meeting her and the arranged date and time on 23 Jan 08 at 08:00.

After the end of the appointment, the employee will re-open the form, find the same appointment and add the info that the client bought a product (serum sublime shine blablabla) for 10 euros (as shown in the subform of form1.jpg). This subform updates a table named CHARGES which has 4 fields: CLIENT_ID, CHARGES_ID, DATE and AMOUNT. The 3 first fields are Combined Primary Keys.

I have already connected the 2 forms with secondary field connection being CLIENT_ID and DATE (which I hide from viewing because there is no user input needed there), so that when I choose a client and a date from the main form, the values for CLIENT_ID and DATE will be passed automatically at the sub form's appropriate fields, (which I also hide from viewing).

Now, suppose the client comes at a later hour (such as 08:15, as shown in form2.jpg) or even at a later day/date, a new appointment will be arranged, and I want the main form to contain the NEW appointment's data (the clients full name, the employee responsible to meet him/her, the date and the time) and the subform to contain the NEW purchases' data (which obviously will be filled in by the database's user).

The problem is that if I add the new appointment, with the same client, the same employee, the NEW date and time, the subform (at the exact moment when I select the date) gets filled in with the purchases from the previous (chronologically) appointment. If I (dare to) erase the old purchases, then the previous appointment is affected.

Is there a way to keep sending the CLIENT_ID and DATE values from the form to the subform automatically (as I already do) but to force the subform to clear the old data (without erasing it, of course) and accept the new data for the purchases of the new appointment? I hope I explained my problem clearly.

Thanks in advance

Alexander
 

Attachments

  • form1.jpg
    form1.jpg
    23 KB · Views: 142
  • form2.jpg
    form2.jpg
    23.6 KB · Views: 133
can you post a sample db..

I would assume, only assume cause i dont think i fully understand your problem, that you need to reset the recordsource of the subform.
 
Hi Matt,

I can post a sample but it's all written in Greek language and I'm afraid it would be difficult to understand. Can you please explain what you mean by "reset the recordsource of the subform"? How exactly can I do that?
 
Can you post it anyway...

Just to clarify, your problem is that when you create a new appointment between the same two people, the subform goes to the previous record? Is that correct?
 
Exactly! Here's the db (stripped down for size limitations). Thanks a lot for your help...

I would like to have the subform open in a blank state but to still be able to pass the date from the main form to the subform automatically and the subform should update the appropriate table with the purchases of the new appointment.

Well, after several hours of brain work, I finally remade the whole form-subform thing from scratch and it worked...

It seems that I had mispelled something...

Anyway, thank you very much for all your efforts

Alexander
 
Last edited:

Users who are viewing this thread

Back
Top Bottom