Link to home
Start Free TrialLog in
Avatar of rjef
rjefFlag for United States of America

asked on

need help updating new location from combo box into a subform query in access using vba.

update-location-with-combo-box-valu.pptx
update-location-with-combo-box-valu.pptxneed help updating new location from combo box into a subform query in access using vba.  please see attachment.
Avatar of Mark Edwards
Mark Edwards
Flag of United States of America image

Your picture gives us a rough idea of what you want to do, so here's a rough idea of how to do it:
Assuming the record you want to update is selected in the subform as seen in the picture and assuming that the name of the Location field textbox is "Location", and assuming that there is a location value is in the combobox when you click the "Update Location" button:

Me.subFormControlNameHere.Form.Location = Me.ComboboxControlNameHere

Open in new window

This is a simple way to do it.  There's are several others, but no need to get any more involved given what we know so far.
Also, please don't use PowerPoint to provide images. A simple screen capture works much better, and many Experts simply won't open files like this (or don't have or use PowerPoint).
I agree with Scott.  
Windows 10 comes with a "Snipping Tool" (found under "Windows Accessories") which is what I use to snag pieces of screens.  
You can save them as files for insertion into EE posts, etc., or paste them into Word, etc.
Also, I got the screenshot of the Snipping Tool below by holding down the Shift key on my keyboard and pressing the "Print Screen" key on my keyboard which puts it on the clipboard, then pasting the screenshot on the clipboard into Word, where I right-clicked on it to "Save As" an image file.  You can also edit the screenshots in Paint or some other image edit app.
If you Google "Snagit", you'll find out it is not free, but you'll also find a few links to quite a few similar apps that are.
TIP:  If the image in EE posts are unreadable, like the one below, click on it to expand it into its own browser window so you can read it.
User generated image
I use simply Print Screen and IrfanView....Select the Screen portion that you need and CTRL+Y to crop accordingly..CTRL + S to Save
Avatar of rjef

ASKER

getting the error 'record set not updateable'

User generated imageUser generated image
Avatar of rjef

ASKER

lets change gears here for a second.  maybe I can just do a  docmd.runsql UPDATE Returns SET Location = 'LW0119B' WHERE [ID] = '202'
but I do not understand the format exactly.  Please advise
SOLUTION
Avatar of John Tsioumpris
John Tsioumpris
Flag of Greece image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rjef

ASKER

my location table is just linked.  I can't add a primary key
Avatar of rjef

ASKER

how do I know what 'N' is?
Avatar of rjef

ASKER

let's put this another way
I have a table called 'Returns' it has a few fields on of which is called 'Location' and It has a primary key on a field called 'ID' which is also  auto numbered
on ID record 202 I want the change the location field value to 'test'.  would the below statement work. if not how do I format it to work (If possible)


docmd.runsql UPDATE Returns SET Location = 'test' WHERE [ID] = '202'
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
"this worked" means you got what you needed - problem solved, right?
Avatar of rjef

ASKER

yes thanks for the help