Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / November 2007

Tip: Looking for answers? Try searching our database.

tranfer data from command button to table

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rookie - 01 Nov 2007 19:52 GMT
I created 2 command buttons at the bottom of my forms view. One button is
called "Surgery" the other is "No Surgery". I want the doctors to click on
"No Surgery" and the word "No surgery" will be updated in the patient's
record in the tables. Can this be done?

I know it starts with going to "On click" in the properties view, but I
don't know how to link it to the specific patient in the table view.

Thanks,
Rookie!
benyod79 - 01 Nov 2007 20:12 GMT
Rookie,

you're right with the On Click. Make it an [Event Procedure]. You can't do it
in Datasheet view though. Click the three dots and it'll take you to Visual
Basic. It'll look something like this:

Private Sub [YourFieldName]_OnClick()

Me.[YourFieldName].Value = "No Surgery"

End Sub

Hope this helps.

>I created 2 command buttons at the bottom of my forms view. One button is
>called "Surgery" the other is "No Surgery". I want the doctors to click on
[quoted text clipped - 6 lines]
>Thanks,
>Rookie!
Steve Schapel - 07 Nov 2007 20:13 GMT
Rookie,

There is a problem with this approach.  Which is that the next time you
go to that patient's record, you won't be able to see which button was
clicked (or indeed if either has been).  Well, that is, unless you have
the surgery/no surgery field dispolayed on the form... and then if you
have that, there's no point in using command buttons to enter it, as it
would be just as easy entering it directly on the form using a combobox
or something, know what I mean?

There is a nice way you can do this though.  First of all, make the
field in the table that the surgery/no surgery relates to into a Number
data type.  So 'Surgery' will be entered into the table "behind the
scenes" as 1, and 'No Surgery' will be entered as 2.  Don't worry - when
it comes to the point of needing to display this data for the users, it
is easy to get it to actually show up as the human-readable "Surgery"
and "No Surgery".

Then, on your form, put an Option Group which is bound to this field in
your table.  And then add two Toggle Buttons to the Option Group.  Make
the lables on the toggle buttons to read 'Surgery' and 'No Surgery'.
Now you've got something that looks pretty much like the 2 command
buttons you originally had.

So now, the doctor can click 'Surgery' or 'No surgery'.  You don't need
to use a macro or code to do anything.  Which button was clicked will be
clearly visible because the button will be of a 'sunken' style.  And
this will be shown for each patient the next time the form is opened at
their record.

Of course, there will be a bit of a learning curve for you in making
this happen.  But it is actually not difficult, and will be worth the
effort.

Signature

Steve Schapel, Microsoft Access MVP

> I created 2 command buttons at the bottom of my forms view. One button is
> called "Surgery" the other is "No Surgery". I want the doctors to click on
[quoted text clipped - 3 lines]
> I know it starts with going to "On click" in the properties view, but I
> don't know how to link it to the specific patient in the table view.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.