Filling down using combo box and subform

  • Thread starter gymcshoe via AccessMonster.com
  • Start date
G

gymcshoe via AccessMonster.com

In my main form I have a combo box which I am able to select a country (i.e.
US, UK, etc). I have a subform that shows various records with a blank column
titled "market". I would like to populate each record (in the market column)
with the country selected from the combo box. What's the code I use in the
afterupdate? Thanks
 
A

Al Campagna

gymcshoe,
Run an Update query against the subform table.
If your combo was named cboMarket, the update
query would use the main form's combo for the update value.
Forms!YourFormName!cboMarket
You should also Refresh just before you run the Update query,
and I would recommend you always ask the user before running the update.
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 
G

gymcshoe via AccessMonster.com

Thanks Al, but is there a way in VBA to do it? like a loop? that way it's
more "real-time"?
 
G

gymcshoe via AccessMonster.com

gymcshoe said:
Thanks Al, but is there a way in VBA to do it? like a loop? that way it's
more "real-time"?


I've done something similar in the past but with checkboxes:

Private Sub Check3_AfterUpdate()
Dim db As DAO.Database
Dim bValue As Boolean
Dim strSql As String

Set db = DBEngine(0)(0)
bValue = Nz(Me.Check3, False)
strSql = "UPDATE [Reviewer Table 2] SET [Reviewed] = " & _
IIf(bValue, "TRUE", "FALSE") & " WHERE [Reviewed] " & _
IIf(bValue, "= FALSE", "<> FALSE") & ";"
db.Execute strSql, dbFailOnError
'MsgBox db.RecordsAffected & " record(s) changed."
Set db = Nothing

Instead of checkboxes i'd like to use a combo box on the main form and
populate the column in the subform.. any suggestions? Thanks
 
Top