Topics Search

Create a new record using a macro?

Create a new record using a macro?
Views: 36
I'm building a relocation database. It is built similarly to the expense reports template already in Access 2007. I have a main form "Expense report" and a subform "Expense Details".

On the employee table Clock # is the primary key and cannot be duplicated. What I want to do is create a new expense report for each new employee (a dummy record to populate a zero value for each category of expense type).

So when I enter the employee and save the record it would automatically create a record with all the specified values, only changing the clock # (as input on the employee form).

I don't want to build the default values because each employee may have multiple expense reports with different expense types.

My thought would be to copy the entries in say "record 4" (autonumber field), only changing the clock # as input on the employee form.
Sponsored Links:

More topics


Button to Create New Record

I would like to create a button with a macro that will bring up a blank form to create a new record (as opposed to going directly to the datasheet table). There are options to Save a Record, Refresh a Record, Search for A Record, Delete a Record and Show All Records, but I don't see a macro to create a new record. Can this be done? If not through a macro, then

MACRO for emailing a single record

me please. I am very new to Access

I have created a database for recording Quality issues from various customers. I have also created a FORM for ease of entry of data. What I want to do is create a BUTTON for this FORM that when clicked will create a PDF of the current record only and attach it to an email. I have tried to use the SendObject action and have set up the email side of things but the problem I have is that the PDF that has been created has ALL of the records listed in it and not a singular record.

I suppose a macro similar to PRINT RECORD would be required.

Would this be able to be done as a macro or would VB be required?

I hope to hear from someone soon

IsNull and DLookUp - finding if record exists

I'm trying to write a macro that will check if a certain record exists. If not, it will display a message box and stop the macro. If it does exist, the rest of the macro will run. My condition is:


When I try to run my macro, nothing happens, regardless of the value in txtSerialNumber (so regardless if the Serial Number exists or not). When I remove these lines, my macro runs fine.

Search for Record, create new if not existant

I'm trying to create a macro to execute after a form text box updates. I'm aware of how to attached the macro to the "After Update" event but I'm having trouble with the macro itself.

What I'm looking to do is take the value of cell that has just been updated and use that for the search criteria to look at the history table and search for that value in a specific column. If the value exsists, do nothing, if it doesn't exsist create a new record and populate the value using the search criteria.

The only start I have is I believe i've found the code to create a new record which I think is : "DoCmd.GoToRecord , , acNewRec

Macro on New Record

I would like to record the user's name that enters new records.

To accomplish this I am thinking I need to run a macro that that updates the appropriate field but I am not sure of the best event to trigger the macro. Perhaps there is a better way

Need to run a macro that filters only current record

I have a very simple form with some command buttons that open other forms which I want to contain data related only to the active record. Currently, the forms that open with the macro only open with the first record in the database no matter which record I'm viewing on the main form. Can anyone help me set up the correct filter in the macro for this

Stoping Macro on last record

I'm trying to run a macro which loops going to each record on a form. I know I can run a macro within a macro and use the repeat count & repeat expression. Using the repeat count isn't an option as I cannot be sure how many records I have at any one time. I would like to use the Repeat expression option, to stop the macro when it reaches the last record, but I am unable to figure out a way to do it

Macros to create records?

Can you use a macro to create a record? If so, how? I assume you could just write VB code to do it, but I don't know VB, so I was gonna try to get a macro to do it for me.

Macro to open form to a particular record

I have two forms: "Employees" & "Employee Badge".

I want to create a button in "Employees" form and press it, so that "Employee Badge" form opens displaying only the record that was on the "Employees" form at the time I pressed the button.

I have created a macro to do this. The "Action" of this macro is "OpenForm".

Can someone please tell me what I need to put in the "Where Condition" of the macro?
Or is that "something" entered in "Filter Name" of the macro?

How do I get a macro to move to the next step after a conditional stop

How do I macro to step to the next action after a conditional stop? I have a button to open a form to the record selected. I want a message box to show if no record is selected.

In my macro I have:

IsNull([employee_ID]) MSGBox


When the [employee_ID] is null the message dispalys and the macro stops, however the open form button will nolonger work even if I select a record. How do I get my macro to work after it has stopped