Troublesome textbox

meadt

Registered User.
Local time
Today, 04:16
Joined
Oct 29, 2009
Messages
45
Hi Guys,
Using a textbox to input information into a table, always in the same place. But I can't get it to work properly. Every time I run it, it comes up with a box that wants a value for strPath. See code below:

Private Sub EnterPath_AfterUpdate()

Dim strPath As String
On Error Resume Next

DoCmd.SetWarnings False

strPath = EnterPath.Value
DoCmd.RunSQL "UPDATE [DataSource] SET [FilePath]=strPath WHERE [ID]=1"

DoCmd.SetWarnings True

End Sub

Any pointers? Thanks for your help again guys.

T.
 
If it's a numeric value:

DoCmd.RunSQL "UPDATE [DataSource] SET [FilePath]=" & strPath & " WHERE [ID]=1"

If it's text, the value would need to be surrounded by single quotes. I would also use the Execute method rather than RunSQL.
 

Users who are viewing this thread

Back
Top Bottom