Temporary Form with 2 Sub form Update Main Form And its Sub form ?

  • Thread starter Alam via AccessMonster.com
  • Start date
A

Alam via AccessMonster.com

I have 2 table both are exactly same
PatientRecordTransTb And PatientRecordTb

I know many programmer don’t like TempTb, but in my case I don’t trust some
one to mess
with my Main record table. So simple solution is make tamp table and after
review I click to transfer all records from temp Table to main Table So I
have two forms .

PatientRecTransFm record sources = PatientRecordTransTb
PatientRecordMainFm record source = PatientRecordTb

PatientRecTransFm has 2 button AddRecord And Delete Record

Here is a short story of my code (NOT A Actual Code)

mySQLString = "INSERT INTO PatientRecordTb( LastName,FirstName,Status …ect)â€
mySQLString = mySQLString & " SELECT PatientRecordTransTb.LastName,
PatientRecordTransTb.FirstName….
mySQLString = mySQLString & " FROM PatientRecordTransTb;"
MsgBox Yes No
If Yes: Then
DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunSQL ("UPDATE PatientRecordTransTb SET PatientRecordTransTb.
RecAdded = True;")
DoCmd.RunSQL (mySQLString)
Me.Requery
End If
So far This was working perfect

Now I Add 2 Sub Form in PatientRec Main Fm And PatientRecTransFm
I need to know How can I update these 2 subform record from trans form to
main form ??
Is there is a way may be using child and master from trans form to child and
master main form .
Or How can I pass SQL String From SubFm To Main Form ?
 
J

Jeanette Cunningham

To make the new data show in the main form, do a requery on the main form.
If the DoCmd.RunSQL code is on the subform, then you can go
Me.Parent.Requery



Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 
A

Alam via AccessMonster.com

Thank’s Ms Cunningham for your quick response

1 PatientRecTransFm record sources = PatientRecordTransTb has
.a) sub form1
.b) sub form 2

2 PatientRecordMainFm record source = PatientRecordTb has
.c) sub form1
.d) sub form 2

If the DoCmd.RunSQL code is on the subform, then you can go
Me.Parent.Requery

In both form 1 and 2, both Sub form a & b And c & d are working
excellent in form 1 and 2.

Also cmd Add button transfer all data from 1) PatientRecTransFm to
2) PatientRecordMainFm Using :

mySQLString = "INSERT INTO PatientRecordTb ( LastName , ….e.t.c.â€
mySQLString = mySQLString & " FROM PatientRecordTransTb;"
DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunSQL ("UPDATE PatientRecordTransTb


I need additional SQL string statement for both Sub form a & b in my
PatientRecTransFm SQL string to transfer all record to Sub form c & d

Regards,
H. Alam
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top