forms - "The data has been changed" error when editing underlying record in Access VBA -


i have form in access have 2 unbound multi-select listboxes, code move items between them.

each of fields in table shown in listboxes boolean values - if value true name of field shows in lstselected, , if false shows in lstunselected.

the listboxes have rowsourcetype of value list, , value list generated programatically looking @ underlying record , constructing string field names boolean values true lstselected , false lstunselected.

on form have 2 buttons, cmdmovetoselected , cmdmovetounselected. when click on cmdmovetoselected changes boolean value of underlying field selected items in lstunselected listbox false true executing sql string, rebuilds value lists both of listboxes.

i have of working fine. if me.lstunwanted.requery , me.lstwanted.requery moves , shows correctly, , underlying fields edited correctly, when click on else on form error:

the data has been changed.

another user edited record , saved changes before attempted save changes.

re-edit record.

now i've found way around (jobdetailsid primary key of record being dealt with):

    dim intcurid integer      intcurid = me.jobdetailsid      me.form.requery      me.recordset.findfirst "jobdetailsid = " & curid 

this requeries form , moves current record, , gets rid of error, causes there delay , form flicker while opens @ first record, changes correct record , repopulates list boxes.

is there way away error, or trigger programmatically can catch turning warnings off via vba?

thanks in advance.

maybe helps not bind form table being altered cmdmovetoselected, query doesn't contain boolean fields. if cmdmovetoselected alters 1 or more boolean fields, record changed, query result isn't. not sure if it's sound though.

it sounds bit design problem rather form problem, storing options in boolean fields instead of related table.


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -