|
-
Aug 5th, 2005, 10:59 AM
#1
Thread Starter
Member
Why wrong?
Private Sub Voeg_nieuwe_oplossing_toe_Click()
CurrentDb.Execute "INSERT INTO TblOplossingen (Oplossing) VALUES ('" & TypnieuweOplossing.Value & "')"
IDMAX = "Select MAX ID from TblOplossingen"
CurrentDb.Execute "INSERT INTO TblKruis (IDFout, IDOplossing) VALUES ('" & KiesFout.Value & "', '" & IDMAX.Value & "')"
End Sub
The IDMAX is the autonumberfield in a table.
greetz
-
Aug 5th, 2005, 11:39 AM
#2
Re: Why wrong?
Try..
IDMAX = "Select MAX(ID) from TblOplossingen"
or
IDMAX = DMax("ID","TblOplossingen")
Danny
Never Think Impossible
If you find my answer helpful then please add to my reputation
-
Aug 5th, 2005, 11:45 AM
#3
Thread Starter
Member
Re: Why wrong?
VBdebugger says the fault lies in:
CurrentDb.Execute "INSERT INTO TblKruis (IDFout, IDOplossing) VALUES ('" & KiesFout.Value & "', '" & IDMAX.Value & "')"
I would think instead of Value something else but i don't know what exactly.
greetz
-
Aug 5th, 2005, 11:55 AM
#4
Re: Why wrong?
"The IDMAX is the autonumberfield in a table." -- no it isn't.... it's a text string. You're setting it to a SELECT, but you never execute it or anything. Then in the very next line, you try to use like it's a recordset or something.
Tg
-
Aug 5th, 2005, 12:17 PM
#5
Thread Starter
Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|