Search form needs to allow updates

PartsPig

New Member
Joined
Sep 13, 2024
Messages
12
Office Version
  1. 365
Platform
  1. Windows
I am using an example DB (found at Microsoft Access tips: Search criteria) to create a search form to locate specific items in my DB tracking table. I pretty much copied everything directly from that example DB and changed the names to match my table. The search form works like a champ however in the example DB I am using it states the form cannot be used to update an existing record. If that is truly the case then the search form is of no use to me since the only reason I am searching for an item is to update it. If the search form could also allow new entries, that would be a bonus so I could have one form to do it all.

I should mention the search form has a text box for every field in the record so the desire is to find the record then update it on the form and save the update somehow.
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
AFAIK you can only solve this by either using a main form/subform relationship or opening a second form with the results. In the former, the main form contains the controls in which you provide the search criteria and the subform (datasheet or continuous) produces the records. When all the criteria is in and you click your command button, you'd set the subform recordsource to be the sql that you created in vba. To clear the form you'd set its recordsource to "".

EDIT - I've seen that page before but have never played with Allen's form. I see that the records can't be edited because the controls are locked to prevent edits. I would have thought it OK to have the bound controls unlocked and still be able to have unbound controls for the criteria. In that case, I'd what I posted would be incorrect, but still of value as far as doing another approach is concerned.
 
Upvote 0
As @Micron pointed out the controls are just locked. Unlock them and you can edit the data.
Can you show exactly where it states you cannot update, as I searched for update and only found two occurrences?, neither of which state that.
 
Upvote 0
It could be that the part about AllowEdits is being mis-interpreted (I did at first)
Text boxes in the Detail section have the Locked property set, so users do not change the data. (You cannot use the form's AllowEdits property, as this prevents you using the unbound criteria boxes as well.)
I think AB's intent was to just provide a search form that still protected data from edits. Perhaps he should have said if you want to be able to edit the records, don't lock the controls.
IMO, you are always using the AllowEdits property. It's just either True or False (yes/no).
 
Upvote 0
As @Micron pointed out the controls are just locked. Unlock them and you can edit the data.
Can you show exactly where it states you cannot update, as I searched for update and only found two occurrences?, neither of which state that.
I did unlock those field controls and it appears to be doing what I was hoping to accomplish. I guess when I was reading the write up on the web page the part in parenthesis below had me thinking allowing editing as a whole would cause problems. Thanks for the follow up. Much appreciated.

Text boxes in the Detail section have the Locked property set, so users do not change the data. (You cannot use the form's AllowEdits property, as this prevents you using the unbound criteria boxes as well.)
 
Upvote 0

Forum statistics

Threads
1,224,520
Messages
6,179,270
Members
452,902
Latest member
Knuddeluff

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top