How to send data (add a new record) via a macro?

M

markmarko

I have to imagine it's possible to use a macro to create a new record in a
given table, and send it data. Is it possible to do this?
 
K

Ken Snell \(MVP\)

Well, yes, in a manner of speaking, it's possible. But we'll need to know
more details about the context in which you want to do this, and from where
the data come.

Are you sure you need a macro for this? Can you not use a form for this
instead?
 
M

markmarko

Well, no, I'm not sure... I'm trying to figure this out as I go, so I'm not
well versed in methods.

Ok, here's one context (there are others, but we'll go with just this).
I have a table called SalesCodes with list all our possible sales products.
Another Table called CurrentDeals list package deals. They have package
names, then the related Sales Codes for each Package Deal is listed in that
deal's record.

Now, on the Sales Order entry form, I want the user to be able to use a
lookup to select the approprate package deal (from the CurrentDeal table).

Here's where the question comes into play... I would like the Orders Subform
to auto-populate with the appropriate Sales Codes which are associated with
that particular package deal.

Does that make sense? Basically, once the package is selected, I'd like it
to look at the record in the Current Deals table, find the appropriate Sales
Codes, and create 1 record per Sales Code in the subform.

Thank you very much!
 
K

Ken Snell \(MVP\)

I apologize..I've been out of town on business, and just got back. I'll post
a reply to this followup as soon as I can. Thanks.
 
K

Ken Snell \(MVP\)

So essentially you want to create order details records, one for each sales
code, when you choose a package deal value.

This can be done by adding records to the subform's Recordset, which can be
done by code or macro. The programming also would need to provide values for
any required fields in the record before it can finish adding the record and
add the next one.

You'll need to give us more details:

1) What is the table and field structure for the CurrentDeals table? How are
the separate Sales Code values stored for a single Package Deal?

2) What is the RecordSource for the subform? If it's a query, what is the
SQL statement for that query?

3) What fields are required to have a value in the subform's RecordSource
query?
 

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