Newbie Question

  • Thread starter Thread starter Maggic
  • Start date Start date
M

Maggic

I know how to duplicate information from a field say "service date" to the
same field in subsequent records i.e. by pressing the Control & quote key
together during the data entry process. However I would like to do this
automatically by using an event procedure, but don't know how to program it
to access data from a field in a previous record.

Any help with this would be much appreciated.

Maggic
 
Hi Maggie,

Put the following in the AfterUpdate event of your form

Const CQuote = """" 'that's two quotes, 4 quote marks

Me!txtExamDate.DefaultValue = CQuote & Me!txtExamDate.Value & CQuote

If you're going to use this code on more than one form I'd make CQuote a
global constant. Otherwise it can go in the declarations area of the
subroutine

As you can see, if you have several TextBoxes that you want to hold the
current value as the default just keep copying the Me!txtExamDate ... line
and always change the name appropriately.

Shame on me, I've lost the thread of attribution but I believe Allen Browne
posted the code.

HTH
 
Many thanks for your reply .. one other question .. the article indicates
that the technique described applies to Access 2000, does it work in Access
97? ... apologies, I should have mentioned that in my original post.

Maggic
 
Maggic,

Yup. Never hurts to mention what version you are using.

As Van already mentioned, and gave you the 97 article number to, it does work in 97.

A couple of points.

First, although in this case it seems minor, the code in the article I sent you is has better style. It specifies what library (DAO)
the Recordset object is coming from. In the 97 days, it was rare to be this explicit.

Second, be brave! :-) How do you think the rest of us learned this stuff anyway? We weren't born with it. (Well, maybe Van was. :-)
Experiment a little. *ALWAYS* with a backup! Make a *COPY* of your database and give it a try. Worse case is that it won't work and
you can ask for more help.

Van, thanks for jumping in with the other article number. You're a good man!

--

Sco

M.L. "Sco" Scofield, MCSD, MCP, MSS, Access MVP, A+
Useful Metric Conversion #16 of 19: 2 monograms = 1 diagram
Miscellaneous Access and VB "stuff" at www.ScoBiz.com
 
No. I wasn't born with "it".

I started using Access without knowing the Knowledge Base. Basically, my
resources were Access Help and Roger Jennings' Using Access.

I remembered experimenting / struggling with PrtMip for 3 days before I
decided that the Help topic was wrong and tried to code what I thought was
the correct coding. Finally I got PrtMip working correctly. Had I known
the KB (which had an article on PrtMip), the whole thing should have taken
probably 2 hours.

--
Cheers
Van



M.L. Sco Scofield said:
Maggic,

Yup. Never hurts to mention what version you are using.

As Van already mentioned, and gave you the 97 article number to, it does work in 97.

A couple of points.

First, although in this case it seems minor, the code in the article I
sent you is has better style. It specifies what library (DAO)
the Recordset object is coming from. In the 97 days, it was rare to be this explicit.

Second, be brave! :-) How do you think the rest of us learned this stuff
anyway? We weren't born with it. (Well, maybe Van was. :-)
Experiment a little. *ALWAYS* with a backup! Make a *COPY* of your
database and give it a try. Worse case is that it won't work and
 
I used the code you suggested and it works great .. Many thanks for your
help, much appreciated!

Maggic
 
Thanks a lot for the information .. nice to know where to go in future. My
reference for Access 97 VB is "Step by Step Microsoft Access 97 for VB" from
Microsoft Press .. its good for a newbie, but limited, so the knowledge base
will come in handy.

I have another "perhaps" small problem, but will try to solve it .... quite
a possibility that I'll be back here again :)

Once again thanks to Sco, Van & Larry ... much appreciated.

Maggic


M.L. Sco Scofield said:
Maggic,

Yup. Never hurts to mention what version you are using.

As Van already mentioned, and gave you the 97 article number to, it does work in 97.

A couple of points.

First, although in this case it seems minor, the code in the article I
sent you is has better style. It specifies what library (DAO)
the Recordset object is coming from. In the 97 days, it was rare to be this explicit.

Second, be brave! :-) How do you think the rest of us learned this stuff
anyway? We weren't born with it. (Well, maybe Van was. :-)
Experiment a little. *ALWAYS* with a backup! Make a *COPY* of your
database and give it a try. Worse case is that it won't work and
 
Back
Top