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 Programming / November 2006

Tip: Looking for answers? Try searching our database.

Text update from form

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Gaetanm - 27 Nov 2006 20:08 GMT
I have a bound (NOTE) text box on my form txtJob_activity, to my clock_table
in the Activity column. I'm able to update everything else on the form but
can't seem to get this text in the box to update the record.
Here is my code to update via a button:

Private Sub Command21_Click()
DoCmd.SetWarnings False
Dim SQLstrg As String

SQLstrg = "UPDATE Clock_Table SET [StopDate] = # " & Me.StopDate & " #WHERE (
([StopDate] Is Null) And ([EmployeeID] = " & Me.[EmployeeID] & "));"

DoCmd.RunSQL SQLstrg
DoCmd.SetWarnings True
Me.cboEmployeeID = Null
Me.StopDate = Null
Me.txtJob_Activity = Null
DoCmd.OpenForm "frmclock_start_table"
DoCmd.SelectObject acForm, "frmclock_start_table"
End Sub

Any suggestions

Gaetanm
Douglas J. Steele - 27 Nov 2006 20:19 GMT
You need a space between the # and the keyword WHERE.

Also, just in case this code is ever run by a user whose Short Date format
is set to other than mm/dd/yyyy, you'd be safer using:

SQLstrg = "UPDATE Clock_Table SET [StopDate] = " & _
 Format(Me.StopDate, "\#mm\/dd\/yyyy\#") & _
 " WHERE [StopDate] Is Null " & _
 " AND [EmployeeID] = " & Me.[EmployeeID]

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

>I have a bound (NOTE) text box on my form txtJob_activity, to my
>clock_table
[quoted text clipped - 22 lines]
>
> Gaetanm
Gaetanm - 27 Nov 2006 20:46 GMT
>You need a space between the # and the keyword WHERE.
>
[quoted text clipped - 8 lines]
>>I have a bound (NOTE) text box on my form txtJob_activity, to my
>>clock_table

Douglas
Thanks for the imput but it does not solve the problem I mention about the
text box. I don't have the text box in my code that is what I'm having a
probelm with . Any suggestions

Gaetanm
>[quoted text clipped - 22 lines]
>>
>> Gaetanm
Douglas J. Steele - 27 Nov 2006 21:02 GMT
>>You need a space between the # and the keyword WHERE.
>>
[quoted text clipped - 15 lines]
>
> Gaetanm

Your code assumes you've put a date in the text box named StopDate, and it
updates the table using that date. Once it's updated the table, it resets
the text box to Null.

What date do you want in that text box?

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

Gaetanm - 28 Nov 2006 04:52 GMT
>>>You need a space between the # and the keyword WHERE.
>>>
[quoted text clipped - 7 lines]
>
>What date do you want in that text box?

Hi Douglas

I do't want a date in the text box. I will be putting in information in the
text box . What I need to know is this part. How do I update the information
from my textbox to my tabel column called Activity.

In other words what do I have to add and where do I add in my update
statement that is already there
to make this happen.

All the update works fine except I cannot figure out
how to update the text to the Activity column
in my table.

Gaetanm
 
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.