|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Update query linked to a filtered form
Hi,
I have a form that was created based on a query bringing back all information from a table. I want users to be able to enter information into the table for one field only. THis works fine, however if they have to enter the same information for a number of records I would like them to be able to do this in bulk. If the apply numerous filter by selections on this form is there anyway they can type a value into a text box at the bottom of the form and hit a button that will update the field for each record within the filter? Any help would be greatly appreciated. Cheers, |
|
#2
|
|||
|
|||
|
Sure...You can use two methods:
1. Create an Update query based on the form's underlying filtered query using the Textbox on your form and then run the Update query from your command button. 2. Use an SQL statement behind the command button Dim strSQL As String strSQL = "UPDATE QueryName SET QueryName.[FieldName] = TextBoxName;" DoCmd.RunSQL strSQL lwells |
|
#3
|
|||
|
|||
|
Thanks for the suggestions,
I think the problem with that is that the users will be just selecting fields and then pressing 'filter by selection', therefore the query doesn't specify what is being filtered. |
|
#4
|
|||
|
|||
|
Gotcha,
Okay use the RecordSet Clone to update with. Using the On Click of your command button paste the following code: Dim rs As Recordset Set rs = Me.RecordsetClone rs.MoveFirst Do Until rs.EOF With rs .Edit !FieldName = TextBoxName .Update End With rs.MoveNext Loop MsgBox "A Total Of " & rs.RecordCount & " Records Were Updated" Set rs = Nothing Me.Refresh Just be sure to use the exact name of the field from the query and the exact name of the textbox from your form shown in bold above. lwells |
|
#5
|
|||
|
|||
|
That works great!
Thanks so much for your help. |
![]() |
| Viewing: Dev Articles Community Forums > Databases > Microsoft Access Development > Update query linked to a filtered form |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|