ms-access


How to force access to begin a new record


I have a form with a few bound fields and a few 'custom made' checkboxes, which set values per vba. When I now start a new record with 'DoCmd.GoToRecord , , acNewRec', Access clears my form but won't create a fresh ID until a value is entered into one of the bound fields. Since my checkbox-fields are not bound, any changes before a bound field has been edited won't be saved. I tried adding values via sql statements, but access throws an error after I change another field stating that the current recordset has been changed so I doubt that this is the way to go.
My form is based on a query and witch vba I set the checkboxes like [value_x] = true (which works fine when I first enter data into a bound field and thereby a new record is created).
(Another way to avoid this would be to set any bound field during the onload-event to a value and remove the value afterwards. But that's not very clean I guess ..)
After testing a few approaches I found my earlier stated idea to be the easiest approach. This means I set a value of a bound field in the form_load event and work with me.dirty where neccessary.
Of course I have to delete empty recordsets afterwards (if someone only opens and closes the form), but that can be handled very easy.
Another great idea was the one Robert Harvey gave me. He suggested to add a click event to my unbound custom checkboxes and use this to change a hidden bound checkbox field, which also worked great.

Related Links

MS Access 2003 - Auto assigning an Identification Number
Ms access: Autocomplete field with values from another table
MS-Access: hotkey to display a message box
.mdb - Access - database appending # on image file
MS-Access 2007 - 255 character limit for exports and field concatenation
Avoiding MaxLocksPerFile via odbc connection to MS Access
Access MDB: do access MDB files have an upper size limit?
Problem evaluating NULL in an IIF statement (Access)
WM_SETFOCUS Event not fired Microsoft Access 2000
Access VBA sub with form as parameter doesn't alter the form
Where can I find MSAccess Control in Database
MS Access 2003 - Really simple query
Query to add missing rows using values from prior period
How can I know which item in a mult-select Microsoft Access listbox was clicked?
Is it possible to save year 1 to 99 as date-value in Access database?
How to bottom-align string in Access report textbox?

Categories

HOME
testing
ionic-framework
gerrit
netsuite
server
mediawiki
kde
gis
leon
ip
alpha
qore
paradox
python-unittest
maude-system
ssl-client-authentication
dax
modx-revolution
orchardcms
hex-editors
fallback
dynamics-crm-online
ghc
foselasticabundle
oxyplot
swiftlint
autocad-plugin
tokenize
tdd
rst2pdf
fopen
.net-4.0
xquery-3.0
uisplitview
ioio
calibre
mmenu
devextreme
hot-module-replacement
greenrobot-eventbus
graphenedb
particles.js
email-templates
nxlog
xml-documentation
termination
logparser
celery-task
dotnetzip
typed-lambda-calculus
hittest
bind9
smart-table
nested-sets
android-fonts
elements
dstu2-fhir
skype4py
qcustomplot
eclipse-clp
t4mvc
collapse
feedback
angular-leaflet-directive
varargs
microbenchmark
sniffer
unity3d-gui
proj4js
modalpopup
relocation
phalanger
jubula
rebol3
doskey
seaside
bundles
excel-2003
django-nonrel
wsdl-2.0
factory-method
distutils
jquery-knob
quickdialog
funscript
pendrive
external-accessory
xmemcached
h.323
gin
libs
zend-decorators
paul-graham
caching-application-block

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App