Re: Error : Item not found in this collection
- From: Jim C. <JimC@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 24 Jun 2005 09:20:05 -0700
"spowell15@xxxxxxxxxxx" wrote:
> You were right Jim, but now I have a new error which doesn't mean too
> much:
>
> "Application-defined or Object defined error"
>
> This is my code so far:
>
> Dim db As DAO.Database
> Dim qd As DAO.QueryDef
> Dim strSQL As String
>
> Set db = CurrentDb
>
> For Each qd In db.QueryDefs
> If qd.Name = "MemoUpdate" Then
> db.QueryDefs.Delete qd.Name
> Exit For
> End If
> Next qd
>
> strSQL = "UPDATE [Action_Diary] SET [Action_Diary].[Action Date]= '" &
> [Forms]![Action_Diary_frm]![Action Date] & "',
> [Action_Diary].[Action Taken]='" & [Forms]![Action_Diary_frm]![Action
> Taken] & "', [Action_Diary].[Comments]='" &
> [Forms]![Action_Diary_frm]![Comments] & "' WHERE
> [Action_Diary].[Action_ID]=" & [Forms]![Action_Diary_frm]![Action_ID] &
> ";"
>
> Set qd = db.CreateQueryDef("MemoUpdate", strSQL)
> qd.Execute
>
> Shirley
>
>
FIrst, the SQL statement for [ActionDate] = date, the result needs to be
enclosed in #, eg [ActionDate]=#01/01/1900#. Second, if Action_ID is text,
the where condition will need to have quotes around the result, eg Where
[Action_ID] = 'action'.
If neither of these fixes the current problem, then post back with the line
in which the error is being generated. Also, if the query MemoUpdates exists
(it will depending on where this bombed) please cut/paste the SQL that is in
there with your reply.
Jim C.
.
- References:
- Error : Item not found in this collection
- From: spowell15@xxxxxxxxxxx
- RE: Error : Item not found in this collection
- From: Jim C.
- Re: Error : Item not found in this collection
- From: spowell15@xxxxxxxxxxx
- Re: Error : Item not found in this collection
- From: Jim C.
- Re: Error : Item not found in this collection
- From: spowell15@xxxxxxxxxxx
- Error : Item not found in this collection
- Prev by Date: Re: Error : Item not found in this collection
- Next by Date: Re: Compare multiple values to reference table for scores
- Previous by thread: Re: Error : Item not found in this collection
- Next by thread: How to remove negative timevalues?
- Index(es):
Relevant Pages
|