Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DoCmd ? 3

Status
Not open for further replies.

kermitforney

Technical User
Mar 15, 2005
374
0
0
US
Need a Do Cmd for an After Update, Event Procedure.
This is what I need.
When a user inputs the date into the main form I would like it automatically update the Date field in the SubForm.
How would I do this?

Is there a site where I can learn VBA inculding SYNTAX so I can start doing this on my own?
 
in the after_update try something like
me!subformName.form!controlName = me.controlName
 
Hi
Please post the code that gave a syntax error.
 
Private Sub Date__AfterUpdate()

me!tblCoilTracking subform.form!Date = me.Date:


End Sub
 
Maybe
me![tblCoilTracking subform].form!Date = me.Date
(PS It is not a good idea to call a control or field 'date').
 
Hey Kermit,

Access has a number of "reserved" names. Date is a reserved name, so when you name a field 'date' then you setting the stage for a potential problem.

HTH,
Shane
 
Ok, cool got it. Thanks Remou for the info and you solution that worked. :eek:)
 
Where do you guys learn this stuff. I ask all the time but no one seems to have an answer?
 
I have found these fora a very good place to learn the stuff not covered by Help and the Object Browser (and for interpreting stuff covered by help ...) :)
 
Hey Kermit,

You asked "where do you guys learn this stuff?"

I have been teaching myself for a few years now and it seems the more I get to know the more I realize what I don't know, but with that being said. I can tell you by my experience, that I have bought books, read articles on line and check several Access forums (pretty much daily). For me, I feel like I have learned more by reading other peoples posts and then reading the solution that someone has given. Once you start searching, on line, for Access related stuff, then you discover that one website will take you to another. For instance, if you look at the Stephen Lebans site I gave you the link to, then your find that his site will link you to several more. I save all of these sites in a folder. I have also built a little database that I call code library and when I find a post or a website that has something that I feel like is good or I can use then I copy and past it into the code library along with it's URL so that I can refer back if I need to. I think the biggest teacher is time. If you keep searching and spent some time doing it then eventually you'll get to where you don't have to ask questions very often.

Hope this helped in some way,
Shane
 
I think most professional developers have a variety of sources. For me, answering a question usually starts with a Google search.

If you are looking for books, I think nothing beats the Access Developers Handbook (Paul Litwin, Ken Getz, Mike Guderloy - for the 2002 version, published by Sybex). If you purchase, and read, both the Desktop and Enterprise volumes, you will know more than 95% of the other Access programmers out there.
 
I've been developing for 10 years now, and here's how it breaks down:
90% is self taught from experimenting, trial and error, resolving error codes, and digging through MS help.

5% is from google and awesome boards like this one.

5% is outright theviery from you good people. Thank goodness for copy/paste! :)

-Patrick

Nine times out of ten, the simplest solution is the best one.
 
ptpaton
Hear, hear! (especially the thievery cut and paste.)
 
Ok, now it works but I get an error message after the date is entered into the field.

Error is this:

Run-Time error '2113'
The value you entered isn't valid for this field.

But once I click end it updates the field like it is supposed to. What gives?

So when I update the DRDate it updates the CTDate field but I get this error before it updates the CTDate field.
 
Are both fields in the table date fields? You would normally get such an error if you tried to update a date field with text, for example. Have you any other code that may be causing this error?
 
No they are both 'like' fields both being Short Date.
I am pretty sure there is nothing else running in te background, but how could I check o make sure?
 
Kermit,

In design view of the mail form, select View>Code. Make sure the only code you've entered is OnUpdate of the date field on the mail form. Then, make sure there's no code running on the sub form by designing the sub form and selecting view code.

If that's not it, try formatting the date when you update it, such as this:

me![tblCoilTracking subform].form!Date = Format(me.Date,"mm/dd/yy")

This shouldn't be a problem, as Remou said, but one never knows.

-Patrick

Nine times out of ten, the simplest solution is the best one.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top