Appending new record to Access Table from Form Input

I have created a two page form in Access to acquire user input on patient surgical infection outcomes.  it has about 30 fields to be entered yes/no or with a comment.

I have a Table with a field to accept the data from every field on the form,


Form Field= ChkVomit     Y/N format           Table Field = Vomit  Y/N format

What would the syntax be to Insert Into the TABLE from the FORM fields?

Thanks

Glen
GPSPOWAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
If your form is bound to that table (i.e. the form's record source property is your table name), then you can map the columns to each textbox using the Row Source property.

Pull that off and you won't need to create a separate query to handle the INSERT.
0
GPSPOWAuthor Commented:
Form is not bound to the Destination table.

Glen
0
Kelvin SparksCommented:
UPDATE yrtable
SET     fieldname = Me!chkVomit
WHERE tableID = me!fieldwithtableID

Kelvin
0
Newly released Acronis True Image 2019

In announcing the release of the 15th Anniversary Edition of Acronis True Image 2019, the company revealed that its artificial intelligence-based anti-ransomware technology – stopped more than 200,000 ransomware attacks on 150,000 customers last year.

Jeffrey CoachmanMIS LiasonCommented:
<No pints wanted>

In other words, you can use the form wizard to create your form.
Select your table as the forms source...
...Then follow the rest of the wizards steps

JeffCoachman
0
GPSPOWAuthor Commented:
So it would be:

Update tblSSIInput
Set SIP = me.ChkSIP
Set SIS = me.ChkSIS
Set PURULENT = me.ChkPur
Set VOMITING = me.ChkVomit
Set COMMENT_ORGAN = me.txtOrg


Do I need the "WHERE" clause?
All the data is coming from the FORM fields.

Thanks

Glen
0
Kelvin SparksCommented:
Update tblSSIInput
Set SIP = me.ChkSIP,
      SIS = me.ChkSIS,
      PURULENT = me.ChkPur,
      VOMITING = me.ChkVomit,
      COMMENT_ORGAN = me.txtOrg
WHERE ....


Yes you need the where clause or every record in table tblSSIInput will have these fields updates to these values.


Kelvin
0
Jeffrey CoachmanMIS LiasonCommented:
I'm confused...
Why not just bind the form to the table, then no code or SQL is required.
Takes  1 minute and you are done...

If you go "unbound", then you have to go the extra step of assigning code for each user action.

In other words, (among other things) now you need a "save record" button, ...where as if the form was bound, the record is saved automatically...

Again, just curious...
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
GPSPOWAuthor Commented:
Thanks

After reading more about this, I agree with you.  I will reconfigure my form and approach.

Thanks
0
Jeffrey CoachmanMIS LiasonCommented:
To be clear, ...I was not trying to take a way from kelvinsparks' post.
kelvinsparksis perfectly valid if the form needed to be unbound.

There are reasons why an Access form should be unbound, ...but looking at your question, all you were doing was adding records (and probably viewing editing and deleting)

All of this functionality is included in a bound form.

Again, .if you go unbound, you are forced to write code for every user action...

JeffCoachman
0
Kelvin SparksCommented:
I'd agree with Jeff. The bound form solution is the easiest and most practical solution in most cases. I'd assumed that you'd considered and discarded that solution.

Kelvin
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.