Prev: ....essai...
Next: Crosstab vs Flex Grid
From: PsyberFox on 20 Apr 2010 09:59 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
From: Daryl S on 20 Apr 2010 10:08 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
From: RonaldoOneNil on 20 Apr 2010 10:11 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
From: PsyberFox on 20 Apr 2010 10:21 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
|
Pages: 1 Prev: ....essai... Next: Crosstab vs Flex Grid |