"Niniel" <(E-Mail Removed)> wrote in message
news:13EA6772-BEC1-4263-A368-(E-Mail Removed)...
> Thanks a lot for the advice!
>
> One last question - is there any particular reason why it's better to save
> only if something has changed? Does saving the record take so much time
> that
> it's not advisable to just save every time I click on the button?
You could save every time, and in fact for a good number of years, I always
used the follwing code to print the ONE reocrd I am looking at:
me.refresh
docmd.OpenReprot "customers",acViewPreview,,"id = " & me!id
The above me.refresh also cases a disk write if the reocrd is dirty. Now,
the me.refresh can cause more i/o then just the disk write, so the "me.drty"
code snip is useally perffered (but, since my forms ONLY are loaded to one
reocrd for reasons of good design/perfmaonce, then me.refresh is not a bad
choice in my case).
I not quite sure of your question, but the suggested code to save was:
if me.dirty = True then
me.dirty = false
end if
Are you suggesting that you reduce the above code to:
me.dirty = false
I don't see a "bug huge" savings in code. So, I not 100% sure of your
question on saving each time. You can, but the given code snip only saves if
you need to. I not much thought about this, but you likely could just use
the one line of code, but the if.....end if block of code is VERY clear to
read, and conveys quite well what the programmer (you) intentions were/are.
>Oh, and also - on my form, I have some text boxes that are only made
>visible
if certain checkboxes are checked.
Is that also something that can be duplicated on a report, or will the
textboxes have to be visible all the time?
yes, on your reports 'on format' event, you can put the code
if me.SomeCheckBox = true then
me.SomeTextBox.visible = false
else
me.sometextbox.visible = true
end if
Do the above type of code for each check box you need. Note that you use the
"details" section format event of your report to do this..
--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
(E-Mail Removed)