Runtime Error

G

Guest

The following error msg is displayed on an after_update event:


Run time error '-2147352567(80020009)':
You can't assign a value to this object.

However when I run debug the object has the correct value.

Any input would be appreciate.
 
G

Guest

If you try to assign a value to a field in the form, on the after update
event of the form, then change it to the before update event of the form.
 
G

Guest

hi ofer,

i'm getting the same error.....but i am trying to use this code

Private Sub Form_Current()
Me.FollowupDate = "SELECT TOP 1 [Screening Log].MR_Number,
IIf(DatePart('w',DateAdd('m',[Months],[RegisteredDate]))=7,DateAdd('m',[Months],[RegisteredDate])-1,IIf(DatePart('w',DateAdd('m',[Months],[RegisteredDate]))=1,DateAdd('m',[Months],[RegisteredDate])+1,DateAdd('m',[Months],[RegisteredDate]))) AS Expr1, [Screening Log].[IRB Number]" _
& "FROM [Screening Log] INNER JOIN MasterTable ON [Screening Log].[IRB
Number] = MasterTable.IRB_Number WHERE ((([Screening
Log].MR_Number)=[Me].[MR_Number]) AND (([Screening Log].[IRB
Number])=[Me].[IRB Number]));"
End Sub


which, as you can see is in the ONcurrent event?!?
 
G

Guest

I have since solved this problem. Try adding Option Explicit in your VBA.

Ted said:
hi ofer,

i'm getting the same error.....but i am trying to use this code

Private Sub Form_Current()
Me.FollowupDate = "SELECT TOP 1 [Screening Log].MR_Number,
IIf(DatePart('w',DateAdd('m',[Months],[RegisteredDate]))=7,DateAdd('m',[Months],[RegisteredDate])-1,IIf(DatePart('w',DateAdd('m',[Months],[RegisteredDate]))=1,DateAdd('m',[Months],[RegisteredDate])+1,DateAdd('m',[Months],[RegisteredDate]))) AS Expr1, [Screening Log].[IRB Number]" _
& "FROM [Screening Log] INNER JOIN MasterTable ON [Screening Log].[IRB
Number] = MasterTable.IRB_Number WHERE ((([Screening
Log].MR_Number)=[Me].[MR_Number]) AND (([Screening Log].[IRB
Number])=[Me].[IRB Number]));"
End Sub


which, as you can see is in the ONcurrent event?!?

Ofer said:
If you try to assign a value to a field in the form, on the after update
event of the form, then change it to the before update event of the form.
--
If I answered your question, please mark it as an answer. That way, it will
stay saved for a longer time, so other can benifit from it.

Good luck
 
G

Guest

hi ken, hi ofer

what i'm really trying to do is as follows and though (thanks ken) i added
the Option Explicit to the Form_Current event, the same error is turning up?!?

Option Explicit

Private Sub Form_Current()
Me.FollowupDate = "SELECT TOP 1
IIf(DatePart('w',DateAdd('m',[Months],[RegisteredDate]))=7,DateAdd('m',[Months],[RegisteredDate])-1,IIf(DatePart('w',DateAdd('m',[Months],[RegisteredDate]))=1,DateAdd('m',[Months],[RegisteredDate])+1,DateAdd('m',[Months],[RegisteredDate]))) AS FollowupDate" _
& "FROM [Screening Log] INNER JOIN MasterTable ON [Screening Log].[IRB
Number] = MasterTable.IRB_Number" _
& "WHERE ((([Screening Log].[IRB Number])=[Me].[IRB Number]) AND
(([Screening Log].MR_Number)=[Me].[MR_Number]));"
End Sub



Ken said:
I have since solved this problem. Try adding Option Explicit in your VBA.

Ted said:
hi ofer,

i'm getting the same error.....but i am trying to use this code

Private Sub Form_Current()
Me.FollowupDate = "SELECT TOP 1 [Screening Log].MR_Number,
IIf(DatePart('w',DateAdd('m',[Months],[RegisteredDate]))=7,DateAdd('m',[Months],[RegisteredDate])-1,IIf(DatePart('w',DateAdd('m',[Months],[RegisteredDate]))=1,DateAdd('m',[Months],[RegisteredDate])+1,DateAdd('m',[Months],[RegisteredDate]))) AS Expr1, [Screening Log].[IRB Number]" _
& "FROM [Screening Log] INNER JOIN MasterTable ON [Screening Log].[IRB
Number] = MasterTable.IRB_Number WHERE ((([Screening
Log].MR_Number)=[Me].[MR_Number]) AND (([Screening Log].[IRB
Number])=[Me].[IRB Number]));"
End Sub


which, as you can see is in the ONcurrent event?!?

Ofer said:
If you try to assign a value to a field in the form, on the after update
event of the form, then change it to the before update event of the form.
--
If I answered your question, please mark it as an answer. That way, it will
stay saved for a longer time, so other can benifit from it.

Good luck



:

The following error msg is displayed on an after_update event:


Run time error '-2147352567(80020009)':
You can't assign a value to this object.

However when I run debug the object has the correct value.

Any input would be appreciate.
 

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

Similar Threads


Top