Read From Table and Write to Table As Well

R

ryguy7272

I have a Form with a TextBox named ‘SIM_Comments’.

I am trying to get a TextBox to show a value in a table, and it works firm
with this:
=DLookUp("[SIM_Comments]","[PatientTable]","[MR] = " & [MR])


The only thing is that I can’t seem to make any updates to the Table. I
would like to see the ‘comments’ in the Table, but also add to the comments,
if I have to make an update. How can I read from the Table and write to the
Table as well? It is just a matter of changing one of the Properties? I
looked around but didn't find a solution anywhere. Please help.

Thanks,
Ryan---
 
T

Tom van Stiphout

On Sun, 25 Jan 2009 17:39:00 -0800, ryguy7272

If you want to write to a table, you have to make that table (or a
query based on that table) the RecordSource for your form. Then "bind"
your textbox to the column you want to update, using the ControlSource
property.

It may be helpful to study some sample applications and to pick up a
book about Access programming.

-Tom.
Microsoft Access MVP
 
R

ryguy7272

Just discovered a much easier way to do this...

I have a TextBox named 'MR'. In the 'AfterUpdate' event I popped in this
code:
Private Sub MR_AfterUpdate()
Me.SIM_Comments = DLookup("[SIM_Comments]", "[PatientTable]", "[MR] = "
& [MR])
End Sub

Now my TextBox named 'SIM_Comments' updates effortlessly.

Problem solved!!

Thanks,
Ryan---

PS, sorry for posting to a couple different groups; I just realized this
now... I was flipping back and forth between multiple screens and must have
lost track of where I posted...

--
RyGuy


Tom van Stiphout said:
On Sun, 25 Jan 2009 17:39:00 -0800, ryguy7272

If you want to write to a table, you have to make that table (or a
query based on that table) the RecordSource for your form. Then "bind"
your textbox to the column you want to update, using the ControlSource
property.

It may be helpful to study some sample applications and to pick up a
book about Access programming.

-Tom.
Microsoft Access MVP

I have a Form with a TextBox named ‘SIM_Comments’.

I am trying to get a TextBox to show a value in a table, and it works firm
with this:
=DLookUp("[SIM_Comments]","[PatientTable]","[MR] = " & [MR])


The only thing is that I can’t seem to make any updates to the Table. I
would like to see the ‘comments’ in the Table, but also add to the comments,
if I have to make an update. How can I read from the Table and write to the
Table as well? It is just a matter of changing one of the Properties? I
looked around but didn't find a solution anywhere. Please help.

Thanks,
Ryan---
 

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