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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

runtime error 2448

Status
Not open for further replies.
Jan 23, 2002
1,106
0
0
GB
I have a form upon which I have created a command button and assigned the "duplicate record" action to it. I used the command button wizard to do this.
When my user attempts to use this command button she gets a 2448 run time error.
When I look at the VBA screen there is a yellow line over the following line of code (code written by my good friend Harvey)

[Forms]![HBOS_Deliverables]![Total_Days] = strDaysLate


I fear my VBA skill stops right there!

Any ideas about how I can resolve this, please?

Please be gentle with me, I can follow simple instructions - just!
many thanks
lynne
 
Hard to say with just that. What I would suggest you do first is get a proper error message if you can. At the beginning of the routine put an on error statement:

On Error GoTo MyError

At the end of your routine place this code:

exit sub

MyError:
MsgBox (Err & " " & Err.Description)


This should display a more understandable error message (hopefully). Once you have done that let me know what happends.
 
at the form end of things it says "you can't assign a value to this object"

When you say at the beginning of my routine, where in this little lot do I type your wise words?!

Private Sub DAYSLATE()

If (Not (IsNull([Forms]![HBOS_Deliverables]![Request_Sent]))) And (Not (IsNull([Forms]![HBOS_Deliverables]![Request_Received]))) Then

Dim vDDWeekdays As Integer
Dim vDDCaldays As Integer


vDDWeekdays = DateDiff("d", [Forms]![HBOS_Deliverables]![Request_Sent], [Forms]![HBOS_Deliverables]![Request_Received]) - DateDiff("ww", [Forms]![HBOS_Deliverables]![Request_Sent], [Forms]![HBOS_Deliverables]![Request_Received], vbSaturday) - DateDiff("ww", [Forms]![HBOS_Deliverables]![Request_Sent], [Forms]![HBOS_Deliverables]![Request_Received], vbSunday) - DCount("*", "qryWkDayHolsEngland")
If ((Weekday([Forms]![HBOS_Deliverables]![Request_Sent]) >= 2) And (Weekday([Forms]![HBOS_Deliverables]![Request_Sent]) <= 6)) Then
vDDWeekdays = vDDWeekdays '+ 1 PUT THIS BACK IF INCLUSIVE OF DAY SENT
End If
vDDCaldays = DateDiff(&quot;d&quot;, [Forms]![HBOS_Deliverables]![Request_Sent], [Forms]![HBOS_Deliverables]![Request_Received])

Dim strDaysLate As Integer

strDaysLate = 0
Select Case [Forms]![HBOS_Deliverables]![Deliverable_Name]
Case 1
strDaysLate = vDDCaldays - 30
Case 2
strDaysLate = vDDWeekdays - 3
Case 3
strDaysLate = vDDWeekdays - 3
Case 4
strDaysLate = vDDWeekdays - 5
Case 5
strDaysLate = vDDCaldays - 14
End Select
If (strDaysLate < 0) Then
strDaysLate = 0
End If

[Forms]![HBOS_Deliverables]![Total_Days] = strDaysLate



It's the very last line with the yellow line over it.
I'm sorry to be so thick about this...and I really appreciate your help
thanks
lynne
 
Try changing that line to:

[Forms]![HBOS_Deliverables]![Total_Days].value = strDaysLate
 
thanks for this, I did as you suggested but I fear the error is still there. I understand from my user that this error doesn't actually prevent her from using the command button, and that she also gets it when she tabs from one date field to the next field, which also happens to be a date field.
Any ideas?
many thanks
lynne
 
Check for the format of the field [Total_Days]

if the field [Total_Days] used in query and is based in your current form, check your if you can add record.

Note: you can not use this Field if is used in query with Expression, Regroupement check you Query.
 
Thank you...not quite sure if I lost something in the translation...
The filed Total_Days is a number field in the table, and it is a calculated field in the form.
Not sure what &quot;regroupement check you Query&quot; means..
But I appreciate your help anyway
thanks
lynne
 
You can't not attribute a value on field if is used for calculated in query.

Try this, remove ControlSource from your field [Total_Days]
Change [Total_Days] to [Total_DaysTest] on your form and code and try again the Sub DAYSLATE maybe this correct the error.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top