Microsoft Access Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMicrosoft Access Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old August 3rd, 2005, 05:31 AM
Hobbo Hobbo is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Posts: 5 Hobbo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 22 sec
Reputation Power: 0
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,

Reply With Quote
  #2  
Old August 3rd, 2005, 09:10 AM
lwells lwells is offline
Contributing User
Dev Articles Novice (500 - 999 posts)
 
Join Date: Sep 2004
Posts: 632 lwells User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 21 h 59 m 38 sec
Reputation Power: 5
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

Reply With Quote
  #3  
Old August 4th, 2005, 05:39 AM
Hobbo Hobbo is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Posts: 5 Hobbo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 22 sec
Reputation Power: 0
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.

Reply With Quote
  #4  
Old August 4th, 2005, 01:27 PM
lwells lwells is offline
Contributing User
Dev Articles Novice (500 - 999 posts)
 
Join Date: Sep 2004
Posts: 632 lwells User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 21 h 59 m 38 sec
Reputation Power: 5
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

Reply With Quote
  #5  
Old August 5th, 2005, 04:12 AM
Hobbo Hobbo is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Posts: 5 Hobbo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 22 sec
Reputation Power: 0
That works great!

Thanks so much for your help.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft Access Development > Update query linked to a filtered form


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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 On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT