DateTimeSignatureStamp()

F

Frank

Hi all,

I'm new to Access and Visual Basic. I've built the tables, queries, forms
and reports and I'm ready to write my first code (module?). I know I'm
basically asking someone else to write my code BUT... if anybody will "hold
my hand" here... I learn very quickly by example.

To get me moving quickly I need 3 procedures (or whatever they are called
in Access) AND I need to know "where" to locate them. I'm using a separate
message post for each request for procedure help.

"yisturday i didint no hou ta spel computir programar, taday i r wun".


THANX for your time... Frank


---------------------------------------------------
3 Computers (networked, peer-to-peer)
WindowsXP Pro SP3 (NOT using "simple" file sharing)
Access 2003 SP3
---------------------------------------------------

PROC #3 - DateTimeSignatureStamp() ===========

1) Contain current "best practice" for error handling and debugging

2) Be ACCESSIBLE from anywhere within the Access environment... databases
AND (if possible) the VB Editor

3) DETERMINE the current user (test WindowsXP's logon password)

4) IF the user just pressed the <Shift>+<Ctrl>+<D> hotkey combination THEN

5) IF current focus is an "editable" memo OR textField(of x minimum length)
THEN

6) GET the current date and time

7) INPUT the concatenated string((dateUser)+(twoCarriageReturns)) at the
current cursor location

8) ELSE MESSAGE("can't use that HotKey here")
 
T

Tony Toews [MVP]

Frank said:
6) GET the current date and time

7) INPUT the concatenated string((dateUser)+(twoCarriageReturns)) at the
current cursor location

Use an audit trail at all times.

There's a simple example at
ACC2000: How to Create an Audit Trail of Record Changes in a Form
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q197592

Audit Trail - Log changes at the record level at:
http://allenbrowne.com/AppAudit.html
The article addresses edits, inserts, and deletes for a form and
subform.

Modules: Maintain a history of changes
http://www.mvps.org/access/modules/mdl0021.htm
The History Table routine is designed to write history records that
track the changes made to fields in one or more tables.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 
F

Frank

Hi Tony,

Hey! It's you again! You must be a regular!

THANK YOU for the reply.
Use an audit trail at all times.
<<
Yes sir. I was going to build that in (a little later). I know an audit
trail as something stealthy (unseen, in the background).

The dateTimeSignatureStamp() I'm looking for is to continue using an
existing "formatted" memo field strategy that we are accustomed to. While
inside a "qualified" memo field, the user hits a hotKey, THEN the date, time,
signature and a couple of carriage returns gets inputted THEN the user
contines on with the note. This memo field is part of a predefined report.

I'm looking for some of the more basic app functions (coding examples &
techniques) right now because I need to get some basic conveniences into my
newly created Access apps.
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q197592
http://allenbrowne.com/AppAudit.html
http://www.mvps.org/access/modules/mdl0021.htm
http://www.granite.ab.ca/accsmstr.htm
<<
The Access web & Tony's Main Acces Page... cooooool. Thanks for the pointer.


THANX for your time... Frank
 
T

Tony Toews [MVP]

Frank said:
Hey! It's you again! You must be a regular!

That is correct. See the message count at
http://groups.google.ca/groups/prof...AD2_QIE3Om9pFxX0ew71Z-dypglTmI30pyqYSOLR48WAA
The dateTimeSignatureStamp() I'm looking for is to continue using an
existing "formatted" memo field strategy that we are accustomed to. While
inside a "qualified" memo field, the user hits a hotKey, THEN the date, time,
signature and a couple of carriage returns gets inputted THEN the user
contines on with the note. This memo field is part of a predefined report.

Gotcha. Personally I would put each of those on separate records and
not allow the user to update the old records. This would also retain
the network userid on the record so now you have a much better idea of
exactly who wrote that note. See the Access web at
www.mvps.org/access in the API section. The whole idea being that the
user can't change history. You would insert the user name and Now()
into fields on the form using the forms BeforeInsert event using code.

Tony


--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 
F

Frank

Hey Tony,
http://groups.google.ca/groups/prof...AD2_QIE3Om9pFxX0ew71Z-dypglTmI30pyqYSOLR48WAA
<<
What an accomplishment! GREAT job "T" !!
Gotcha. Personally I would...
<<
If I would have known then (what I know now) I would have done that 20 years
ago... but I didn't. Fortunately This is not a sophisticated "enterprise
level" app I've put together here. Just simple little apps that work better
(for me) than canned software. Also, my small business has never required
any sophisticated security. I usually have to guard (idiot proof) against no
more than three people in my home office and (currently) it's just me (good
time to migrate away from Paradox).
You would insert the user name and Now() into fields on the form
<<
I know that. I was kinda hoping you'd tell me what commands and/or
functions to use. <grin> I already know about Now(), FormatDateTime(), and
how to concatenate.

What command/funtion/method do you use to:
1) GET the user's logon password?
2) GET the user's logon name?
3) Test if the current focus is "inside" a memo field?
4) Input a dataString into a memo field?

What charString does Access recognize as a carriage return?

From OjectPal, I am familiar with:
SWITCH
.... CASE 1, do this #1
.... CASE 2, do this #2
END SWITCH

What's the VB equivalent?
using the forms BeforeInsert event using code.
<<
Thank you. OK, here's another dummy question. I don't know if BeforeInsert
is available inside a "global" module but (if it is) I have several memo
fields (on different forms) to deal with. Is it better to put
DateTimeSignature() in a global module or keep it form specific?

THANX for your time... Frank
 
T

Tony Toews [MVP]

Frank said:
1) GET the user's logon password?

Can't be done. This is be design. If your app could somehow fetch
the password then so could a virus.
2) GET the user's logon name?

API: Get Login name
http://www.mvps.org/access/api/api0008.htm
3) Test if the current focus is "inside" a memo field?

If you are going to use a command button then PreviousControl Property

However you can use the OnGotFocus event to know the cursor has been
position in the field.
4) Input a dataString into a memo field?

me.field = me.field & " " & "some text"
What charString does Access recognize as a carriage return?
vbcrlf

From OjectPal, I am familiar with:
SWITCH
... CASE 1, do this #1
... CASE 2, do this #2
END SWITCH

What's the VB equivalent?

Select case
I don't know if BeforeInsert
is available inside a "global" module

No, it's not.
I have several memo
fields (on different forms) to deal with. Is it better to put
DateTimeSignature() in a global module or keep it form specific?

Sure you could put the code in a module and I would do so. Don't
forget to put Public in the front.

Public Sub DateTimeSignature

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 
F

Frank

Hey Tony,
Can't be done. This is be design. If your app could somehow fetch
the password then so could a virus.
<<
Got it!. Thank you.
API: Get Login name
http://www.mvps.org/access/api/api0008.htm
<<
Never used aan API. I'll check it out. Thank you.
If you are going to use a command button then PreviousControl Property
<<
No, I don't use a button to initiate a memo edit. I just put the cursor at
a location (inside the memo field) where I want the DateTimeSignatureStamp()
to place it's TextString.
However you can use the OnGotFocus event to know the cursor has been
position in the field.
<<
Are you are saying... "put my DateTimeSignatureStamp() in the OnGotFocus
event" and that proc will only be accesible if I am (in fact) inside of the
memo field?

If I am assuming correctly AND looking ahead (below, where we start talking
about "global" modules). How do I test the memoFields's OnGotFocus event
from a "global" module? That event "appears" to be object specific to me.

me.field = me.field & " " & "some text"
<<
This appears to me to me to be appending text "at the end" of the memo
field. Typically I'm inserting text "in the middle" of a memoField.

vbcrlf
<<
Thank you.
Select case
<<
Thank you.
I don't know if BeforeInsert
is available inside a "global" module
No, it's not.
<<
Thank you.
Sure you could put the code in a module and I would do so. Don't
forget to put Public in the front.

Public Sub DateTimeSignature
<<
Thank you.

Just so you know what am trying to do here, this is what I wrote in
Paradox's ObjectPal (back in 1996). It was tied to the memoField's
KeyPhysical method (which during this "translation into Access" I'd like to
stick into a global module). Some of the syntax may be "Greek" to you (just
like Access's is Greek to me) but generally I think you can get a picture of
what I am trying to accomplish. Also, since I am new to this "web group", I
don't if my code formatting (tabs) will carrying into this message's post
(for readability) but I'm keeping my fingers crossed.

============================
method keyPhysical(var eventInfo KeyEvent)

var
da date
ti time
st string
endVar

da = today()
ti = time()

;|| Check for user info
switch
case getNetUserName() = "f" :
st = " - log entry by Frank (Manager):"
endSwitch

;|| If <Shift><Ctrl><T> hotkey is pressed then insert preformated text
;|| and place cursor ready for data entry
if eventInfo.isControlKeyDown() and eventInfo.vChar() = "T"
then disableDefault
if notes.value <> ""
then
endIf
;|| keyChar() types characters into the crrent cursor location
self.keyChar(string(format("DO(%M %D %Y %W ),DM3,DY3,DW2",da)))
self.keyChar(string(format("TO(%H:%M%N),THW,TNA(am),TNP(pm)",ti)))
self.keyChar(st)
self.keyChar(13,13,0) ;||carraige return
switch
case getNetUserName() = "f" :
self.keyChar(" tlkd w/")
self.keyChar(13,13,0) ;||carraige return
self.keyChar(13,13,0) ;||carraige return
self.action(MoveLeft)
self.action(MoveLeft)
endSwitch
endIf

endMethod
============================

THANK YOU for your time... Frank
 
T

Tony Toews [MVP]

Frank said:
If you are going to use a command button then PreviousControl Property
<<
No, I don't use a button to initiate a memo edit. I just put the cursor at
a location (inside the memo field) where I want the DateTimeSignatureStamp()
to place it's TextString.

However you can use the OnGotFocus event to know the cursor has been
position in the field.
<<
Are you are saying... "put my DateTimeSignatureStamp() in the OnGotFocus
event" and that proc will only be accesible if I am (in fact) inside of the
memo field?

Ah, ok, well ignore what I typed as it isn't relevant to what you want
to do.
If I am assuming correctly AND looking ahead (below, where we start talking
about "global" modules). How do I test the memoFields's OnGotFocus event
from a "global" module? That event "appears" to be object specific to me.


me.field = me.field & " " & "some text"
<<
This appears to me to me to be appending text "at the end" of the memo
field. Typically I'm inserting text "in the middle" of a memoField.

Well, I wouldn't do that. To me users can muck with a memo field so
easily and destroy lots of keyboarding work in less than a second.

Nevertheless there is some stuff with selstart and selposn as I
recall.

I would think you can use the OnKeyboard event to moniter for function
keys. Although I haven't done that.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 
F

Frank

Hi Tony
....there is some stuff with selstart and selposn as I recall...
....I would think you can use the OnKeyboard event to moniter for function
keys...
<<
Tanx for those pointers.

THANK YOU for your time... Frank
 

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

Top