MakeItSo:
Thanks mate! Before i read your post i figured it out myself, by writing it like so:
"...DMax('" & [TraineeID] & "', '" &tblTrainee & "')+1, '" & Me!txtfname & "')"
Little bit more long-winded, but it gets the job done.
Anyway, i went on to...
lol, you won't believe this. Before i read your post, i put the TraineeID field back in, and it now works!
What the?!
Anyway, i put your code in, just to be on the safe side. I got this compile error:
Expected: end of statement
[TraineeID] is highlighted
I tihnk there might be missing...
MakeItSo:
Thanks for the file. On loading it, it came up with a message saying the VBA project in the db as corrupt. Suffice to say, all the code was gone. lol - will my troubles never end?
However, i know what the problem is now. I believe the problem to be my autonumber field (TraineeID) in...
MakeitSo:
Yes, i have the table closed, then i open the form, enter a name, click the add button. Then i close the form and open the table - nothing is there.
If it works on your machine, would you be able to send me your demo? My email is: mlongmuir@hotmail.com
It would be greatly appreciated!
If it helps, i'm running MS Access 2002 and i have not changed any of my libraries (i.e. i've havnet included the DAO libraries or anything...not sure if this would affect my results).
Makeitso:
You wouldn't believe it, but i'm getting the same error again..and wowzers, you've already answered it...uh oh. No go. I don't get any errors, but nothing is added to the table.
Here's my code atm. You're obviously whipping up a quick test using the info i've provided, perhaps you...
MakeItSo:
Thanks for the reply mate!
Make sense what you said, however, i've run into a nothing problem.
I made the changes you wrote, but not i get this error:
Run-time error '3134':
Syntax error in INSERT INTO statement.
Highlighted code is:
"DoCmd.RunSQL sSql"
Here's my code...
Hi Team,
Sadly, i'm still going to be a complete newbie for another few weeks - so try not to laugh at my insanely easy questions! (haha!)
Ok, here's the deal (basically):
tblTrainee
- FirstName (text field)
- LastName (text field)
frmAddTrainee
- txtfname (unbound text box)
- txtlname...
Ken,
As soon as it reaches the line: "Rs.Update", i get this error, which i don't understand.
"" Run-time error '3022':
The changes you requested to the table were not successful because they would create duplicate valures in the index, primary key, or relationship...
Ok, i fixed that. Didn't realise Access2K uses ADO by default. So i've added the DAO libraries now. I'm having another problem though, but i'll have a little play around and see if i can resolve it.
In the meantime, if you could send me that sample db, it'd be muchly appreciated. Email...
Hi Ken,
Ok, i've implemented the code from that thread you sent me to. As i'm sure you'd expect, i've hit a snag - probably the first of a few.
When i click the command button i get a compile error: User-defined type not defined.
This line of code is highlighted: "Dim CurDB As...
Ken,
I've had a look over that thread, and it looks to be exactly what i'm after! I'm a bit surprised my search didn't turn it up, but alls well that ends well - and i'm sure it will!
I'll have a crack at converting it into my db tomorrow, when i'm back at work and post here to let you know...
Hi Team,
Here's the setup for my Access2K DB:
Courses (table)
- CourseID (autonumber field)
- CourseName (text field)
Trainee (table)
- CourseID (number; linked to CourseID in Course table)
Add Trainee (form, based on Trainee table)
- lbCourses (list box)
Basically here, i type in the name...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.