A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Browse option and sving folder path



 
 
Thread Tools Display Modes
  #1  
Old April 20th, 2010, 02:59 PM posted to microsoft.public.access
PsyberFox
external usenet poster
 
Posts: 88
Default Browse option and sving folder path

Hi there,

I want a user to select a path from a pop-up and then this folder location
should be saved in a table. Can someone please assist with the last part as
I'm not sure how to update a record from information supplied via a form.

Here is the code thusfar but the last option obviously doesn't work as it
should:

Private Sub cmd_FileLocation_Click()

On Error Resume Next

Dim f As FileDialog
Set f = Application.FileDialog(msoFileDialogFolderPicker)
f.Show
MsgBox ("You have selected: ") & f.SelectedItems(1)

DoCmd.OpenTable "tbl_XSetup_files"
[tbl_XSetup_Files].[FileLocation].Value = f.SelectedItems(1)

End Sub

Thank you kindly!
W
  #2  
Old April 20th, 2010, 03:08 PM posted to microsoft.public.access
Daryl S[_2_]
external usenet poster
 
Posts: 881
Default Browse option and sving folder path

W -

Build a SQL statement and then run it, something like this:

SQL = "INSERT Into tbl_XSetup_files " & _
"(FileLocation) SELECT '" & _
f.SelectedItems(1) & "' AS FileLocation;"

DoCmd.RunSQL SQL


--
Daryl S


"PsyberFox" wrote:

Hi there,

I want a user to select a path from a pop-up and then this folder location
should be saved in a table. Can someone please assist with the last part as
I'm not sure how to update a record from information supplied via a form.

Here is the code thusfar but the last option obviously doesn't work as it
should:

Private Sub cmd_FileLocation_Click()

On Error Resume Next

Dim f As FileDialog
Set f = Application.FileDialog(msoFileDialogFolderPicker)
f.Show
MsgBox ("You have selected: ") & f.SelectedItems(1)

DoCmd.OpenTable "tbl_XSetup_files"
[tbl_XSetup_Files].[FileLocation].Value = f.SelectedItems(1)

End Sub

Thank you kindly!
W

  #3  
Old April 20th, 2010, 03:11 PM posted to microsoft.public.access
RonaldoOneNil
external usenet poster
 
Posts: 345
Default Browse option and sving folder path

Private Sub cmd_FileLocation_Click()

On Error Resume Next

Dim f As FileDialog
Set f = Application.FileDialog(msoFileDialogFolderPicker)
f.Show
MsgBox ("You have selected: ") & f.SelectedItems(1)

DoCmd.SetWarnings False
DoCmd.RunSQL "UPDATE tbl_XSetup_files SET FileLocation = '" &
f.SelectedItems(1) & "'"
DoCmd.SetWarnings True

End Sub

"PsyberFox" wrote:

Hi there,

I want a user to select a path from a pop-up and then this folder location
should be saved in a table. Can someone please assist with the last part as
I'm not sure how to update a record from information supplied via a form.

Here is the code thusfar but the last option obviously doesn't work as it
should:

Private Sub cmd_FileLocation_Click()

On Error Resume Next

Dim f As FileDialog
Set f = Application.FileDialog(msoFileDialogFolderPicker)
f.Show
MsgBox ("You have selected: ") & f.SelectedItems(1)

DoCmd.OpenTable "tbl_XSetup_files"
[tbl_XSetup_Files].[FileLocation].Value = f.SelectedItems(1)

End Sub

Thank you kindly!
W

  #4  
Old April 20th, 2010, 03:21 PM posted to microsoft.public.access
PsyberFox
external usenet poster
 
Posts: 88
Default Browse option and sving folder path

THANK YOU BOTH!!!

"RonaldoOneNil" wrote:

Private Sub cmd_FileLocation_Click()

On Error Resume Next

Dim f As FileDialog
Set f = Application.FileDialog(msoFileDialogFolderPicker)
f.Show
MsgBox ("You have selected: ") & f.SelectedItems(1)

DoCmd.SetWarnings False
DoCmd.RunSQL "UPDATE tbl_XSetup_files SET FileLocation = '" &
f.SelectedItems(1) & "'"
DoCmd.SetWarnings True

End Sub

"PsyberFox" wrote:

Hi there,

I want a user to select a path from a pop-up and then this folder location
should be saved in a table. Can someone please assist with the last part as
I'm not sure how to update a record from information supplied via a form.

Here is the code thusfar but the last option obviously doesn't work as it
should:

Private Sub cmd_FileLocation_Click()

On Error Resume Next

Dim f As FileDialog
Set f = Application.FileDialog(msoFileDialogFolderPicker)
f.Show
MsgBox ("You have selected: ") & f.SelectedItems(1)

DoCmd.OpenTable "tbl_XSetup_files"
[tbl_XSetup_Files].[FileLocation].Value = f.SelectedItems(1)

End Sub

Thank you kindly!
W

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:09 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.