Two questions (About Lookup and also Memo fields)

  • Thread starter Thread starter Kevin Sprinkel
  • Start date Start date
K

Kevin Sprinkel

Hi, pay2ln.

For the first one, use a combo box, selecting the customer
table's key field (usually implemented as an AutoNumber)
and the address field. The easiest way to do it is with
the Combo Box wizard. Open your form in Design mode, and
toggle on the wizard button on the Toolbox Toolbar (it's
an icon that looks like a wand and five stars). Choose
the fields, tell it to hide the key field. What will be
stored in the form's underlying table is the key field
itself, but the form will display your address, and
autofill it for you if the Auto Expand property is set to
Yes (the default).

The 2nd one will take a little code. You may know by now
that Access programming is "event driven", meaning that
certain events can trigger code to be run. In your case,
you can use the AfterUpdate event of the memo field to
either timestamp at the end of the memo or to a Date
field. The latter is probably more desirable, as it would
permit queries by date. In the following code, I've
assumed the name of the form control bound to the date
field is named txtLastChanged:

Private Sub YourMemoField_AfterUpdate()
On Error Goto ErrHandler

txtLastChanged = Date()

ErrExit:
Exit Sub

ErrHandler:
MsgBox Err.Description
GoTo ErrExit

HTH
Kevin Sprinkel

End Sub
-----Original Message-----
Hello,

I have been learning access and would appreciate any
advice that will help me over two hurdles to my first
working effort.
1. I need a way to lookup a record by the address. I'd
like to be able to fill it in and then up pops the record
(searching by number and then street). I have a field
that successfully combines those two now into something
like 101 Smith Road. Can I have a field that where I
start typing in 101 Sm and it goes to that record
similar to an outlook address? I know I can do a lookup
FILTER but that defeats the whole purpose of the form...
2. I need to make long running notes. Obviously, a memo
field works for this. Is there a way to make the memo
field automatically stamp the date and time of the most
recent update in that field. If you have ever used
notepads log feature (any text file with a .log
extension), you'd see what I'm describing.
 
Dive in; the wizard's pretty intuitive. After it's done
its thing, take a look at how it set the Data tab
properties; that will help you learn about how the CBox
works.

Re: code--you can always get help writing the explicit
code. The key thing to understand first is that, unlike
programs you might have written in school that are
started, run til their done, and stop, Access form and
report properties are triggered by Events. Any basic
Access reference will tell you what events are triggered
when, but the beauty of it is that you're provided control
of what happens by writing a procedure that launches when
that event occurs. The most frequent event procedures are
written for the Before_Update and After_Update events of a
control. The former occurs before changes are written to
the control, enabling you to do some error-checking, and
canceling the changed value if it doesn't meet your
criteria. After Update event procedures are usually used
to make other controls visible or invisible depending on
the value entered, change the Row Source of a downstream
combo box, display a message to the user, and other form
manipulations that might depend on the value entered.

Don't be intimidated--start by looking at the code
generated by the wizards. Place a command button on a
form to preview a report, for example, and look at the
code the wizard generates.

Good luck. HTH
Kevin Sprinkel
 
Click on View, Toolbox, or View, Toolbars, Toolbox to
display the Toolbox menu, then toggle on the Wizard button
(Wand/5 stars)

Kevin Sprinkel
-----Original Message-----
Kevin,

My wizard will not activate or do anything when I am in
the design mode. I tried clicking, dragging, etc.... but
nothing goes....
 
Back
Top