Help with a Macro!

  • Thread starter Thread starter Bob V
  • Start date Start date
B

Bob V

I am trying to write a Macro that will enter these thing into my text boxes
on a form, How do I go about writing it?
Thanks for any help.............Bob
tbStartDate1 = DateSerial(Year(Date), Month(Date), 1)
tbEndDate1 = DateSerial(Year(Date), Month(Date) + 1, 0)
cbDailyCharge1= tblServiceInfo,ServiceID(AutoNumber)2

on the subform:
subAdditionChargeChild,AddintionCharge =
tblAdditionalCharges,ChargeNumber(AutoNumber)2
subAdditionChargeChild,AddintionCharge =
tblAdditionalCharges,ChargeNumber(AutoNumber)5
subAdditionChargeChild,AddintionCharge =
tblAdditionalCharges,ChargeNumber(AutoNumber)7
 
I am trying to write a Macro that will enter these thing into my text boxes
on a form, How do I go about writing it?
Thanks for any help.............Bob
tbStartDate1 = DateSerial(Year(Date), Month(Date), 1)
tbEndDate1 = DateSerial(Year(Date), Month(Date) + 1, 0)
cbDailyCharge1= tblServiceInfo,ServiceID(AutoNumber)2

on the subform:
subAdditionChargeChild,AddintionCharge =
tblAdditionalCharges,ChargeNumber(AutoNumber)2
subAdditionChargeChild,AddintionCharge =
tblAdditionalCharges,ChargeNumber(AutoNumber)5
subAdditionChargeChild,AddintionCharge =
tblAdditionalCharges,ChargeNumber(AutoNumber)7

Personally, I'd use VBA.
Here's an article on Access Web that might help. Can't tell you how
to do it with macros. Never use them.

http://www.mvps.org/access/forms/frm0031.htm
 
Bob,

Macros are cool... in their place. In the situation you have descibed,
it sounds like this is not the best appoach. Externally assigning
values to form controls is an unusual thing to do, and is only indicated
in certain data processing scenarios. If I understand you correctly,
your functionality would be achieved by other means. For example, you
would probably be better to use the Default Value properties of the
tbStartDate1 and tbEndDate1 controls. As for the stuff with the
subform, I don't quite understand what you are saying. Do you mean you
want to enter 3 subform records? And for these records to have the
values 2, 5, and 7 respectively in the AddintionCharge field? That's
the best I can work out from what you told us... but it can't be an
AutoNumber field? In any case, it is more likely you would be using an
Append Query to add these records, rather than assigning values to the
subform controls. Once you have the append querysorted, you could use
an OpenQuery action in your macro to automate running the append... but
that's another story.

So, if you need more help with this, you might have to give a bit more
detailed explanation of what you have and what you are trying to achieve.
 
Thanks Steve for your response, Each month I do an Invoice to a Client for
his horse , say 80% of the time the first "say" 4 things I do is the same,
so I was thinking if I had a macro that I could click on my form it would do
these 4 things for me, but the sub form has a continuous form that adds up
the expenses with details and date, It just seems so easy in excel when you
can record a macro but not in access, thanks for the help... Bob but I think
I will give it a miss its not as simple as I thought it would be!
 
Bob,

I understand what you are saying.

Macros in Excel and macros in Access are quite different creatures.
And, of course, Excel and Access themselves are quite different creatures.

I think you will find that what you want to do is not really all that
difficult in Access. But yes, it will mean learning about database
concepts, and learning new skills.
 

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

Back
Top