Module/Macro to copy paste from one field in form to another

reswob

New member
Local time
Today, 16:35
Joined
Oct 23, 2008
Messages
1
I'm an Access noob and I've taken over an already created DB. While I'm somewhat familiar with creating macros in Excel, working with VBA in Access seems to be a totally different animal. Here's my question and I apologize if I'm in the wrong category:

Is there a way to create a macro or a module that will copy the text in one field on a form and paste it to another field on the same form?

If so, can I also append text as I paste it?

I need to take the username that's in one field and paste it into a different field and add the text "@domain.com" at the end (effectively creating an email address).


Thanks

Craig
 
Macro - SetValue

If you're wanting to do this in a macro you should look at the SetValue action when you create a Macro, this should cover what you're after.

You should also be able to append the domain on the end by concatenating the pasted text and "@domain.com".

There are two Arguments to the SetValue Action:

Item - this will be your field which you want to set the value to, i.e. the field that will have the e-mail address in at the end.

e.g. Forms![Frm_Main]![EmailField]

Expression - This will give the field the value you want, this is where you stipulate the copy field and "@domain.com".

e.g. Forms![Frm_Main]![NameField] & "domain.com"

You can attach this macro to a button or an event on your Form.Hope this helps.

Gareth
 

Users who are viewing this thread

Back
Top Bottom