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

Want to update a table via query on clicking command button

Status
Not open for further replies.

tom22london

Programmer
Mar 11, 2003
11
0
0
US
Hi members,

I have a hospital database having a table name ADMISSION, I have a form(ADMISSIONCHARGESDETAIL)through which i charge(fee) patient once they are ready to get discharged from the hospital. this form has primary feild ADMISSION_ID, which is linked with the ADMISSION table's admission_id. I want to put a command button on the form through which i want to update the admission table by putting system date in Dischrage date column of admission table.

following is the stored query which I am running on the click event of the "discharge patient" command button (form name is admissionchargesdetailed)through micro(which calls the stored query), but it always ask for a paramenter (Admission_ID)

UPDATE Admission SET Admission.discharge_date = Date()
WHERE (((Admission.discharge_date) Is Null) AND ((Admission.adm_id)=[Enter Admission ID]));

I want that on clicking Discharge Patient command button, it automatically update the admission table's with discharge date as current system date, for the current record on the form using the admission_id.
 
sillysod:
With regards to bringing things off site/using e-mail, take a look at the comments by CajunCenturion in this thread thread702-850773. This faq faq181-2886 (#12) also addresses the issue.

tom22london:
The way you've created the query, it will ask for a parameter. To avoid that, raplace the [Enter Admission ID] with a reference to the control on the form holding this value. Say if the control on the form holding the admission id is calletd txtAdmId then perhaps something like this:

[tt]UPDATE Admission SET Admission.discharge_date = Date()
WHERE (((Admission.discharge_date) Is Null) AND ((Admission.adm_id)=forms!ADMISSIONCHARGESDETAIL!txtAdmId));[/tt]

- Access will then put [bcackets] around the appropriate part of the reference.

Roy-Vidar
 
Thanx for ur help guys i have solved my problem with the help of royvidor instructions.

cheeers mate
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top