looking for interpretation of this vba line

G

Guest

This is only a portion of vba that runs on form close.
There is a bunch of dim statements before this, and stuff after. If it is
necessary, I can copy that stuff as well. But I have two questions (for now)

' first, what does this line mean?
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

DoCmd.SetWarnings False
Set dbs = CurrentDb

AllValues = " "

'and second, what does this line mean?
RecCntr = DCount("[ORPS Designator]", "[Type]", "[ORPS Designator] =
Forms![ORPS Data]![ORPS Designator]")
If RecCntr > 0 Then . . .

TIA
 
A

Allen Browne

The first line asks Access to simulate whatever is on the first toolbar (the
Form menu), the 6th menu (the Records menu), and the 5th item on that menu
(which is 'Save the Record'), using the standard menu structure that
Microsoft built into Access 95 (version 7.0.)

That kind of cryptic nonsense it generated by Access itself if you use the
wizard to write code. If you wrote it yourself you would be more likely to
use:
RunCommand acCmdSaveRecord
or - if you care about *which* form should get its record saved:
Me.Dirty = False

Your 2nd example means:
Count the number of non-blank values:
in the field called ORPS Designator,
in the table (or query) named "Type",
where that fields matches the value in the text box with the same name, or
the ORPS Data form.

DCount() is one of the domain aggregate functions in Access. For more info
on how to supply the 3 arguments, see:
Getting a value from a table: DLookup()
at:
http://allenbrowne.com/casu-07.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top