Append Problem

rhernand

Registered User.
Local time
Today, 02:40
Joined
Mar 28, 2003
Messages
96
I have two tables.

Pacient- Holds Name, etc. Key is CustomerId defined as AutoNumber.

PacientVisits - Mulitple records per Pacient. Key is CustomerID defined as Number.

I display Pacient data on Pacients Form and Click on Button to bring up PacientVisits records on another Visits Form. If a new Pacient, no records are displayed on Visits Form.

I want to fill out the Visits Form and append to PacientVisits table. I fill out all the data fields, but display the CustomerId from the Pacient table.

When I append the record, the CustomerId is not appended.
 
Do you think you can have your visits form as a subform to the patientsform? That would solve it, I think.

Fuga.
 
Would the PacientsVisits Subform be display over the main Pacients Form every time, or only when I want tio display it?
 
rhernand,

I think that you also have the PatientVisits table with a
unique index on CustomerID. You don't want that.

Wayne
 
About the subform:

I think you can change its property to visible=false.You can have that as the event of a button.

Fuga.
 
Sub Form

This is almost working.

When I show the subform on the main form, the linked field is passed and I can fill up all the fields and append the record with all fields.

However, When I set the Visible to NO on the subform, run a macro that does an Open Form on the subform, the linked field is not passed.

What am I doing wrong?
 
I´m not sure exactly what you´re doing, but I´ll have a try.

My original thought was that you have a button on the main form that simply makes the sub visible or not.

Code:
private sub command1_click

if me.yoursubformscontrol.visible = true then
me.yoursubformscontrol.visible = false
else
me.yoursubformscontrol.visible = true

end sub

On the other hand, if you want to open a form separately, I suggest you make a main/suborm and open the main with a wherecondition.

Code:
private sub command1_click
dim sCustkey as string

sCustkey = me.yourIDfield
docmd.openform ("yourmainform"),,,"mainformIDfield =" & sCustkey
end sub

I think it should work, but I didn´t try it so let me know if it doesn´t.

Fuga.
 

Users who are viewing this thread

Back
Top Bottom