Custom Forms

M

Mike Hudson

I have created a custom form. Code as follows:
(Messy I know, but it does the job)

Function Item_Open()
'Error Handler :p
on error resume next
Dim jobid

'Seed random number generator
Randomize

Jobid = "Unique Job ID:#!# " & Int((99999 * Rnd) + 1)

'Check to see if item already has this.
mypos = InStr(1, Item.body, "#!#")

'If not then stick it on
If mypos < 1 Then
item.body = item.body & vbcrlf & _
vbcrlf & vbcrlf & vbcrlf & vbcrlf & vbcrlf & vbcrlf & vbcrlf & vbcrlf & vbcrlf & _
"Start Time: ......................... End Time: ........................." & vbrlf & _
vbcrlf & vbcrlf & "Date: ..................................." & vbcrlf & vbcrlf & vbcrlf & vbcrlf & vbcrlf & vbcrlf & _
"Please get the customer to complete the following details on job completion:" & vbcrlf & _
"Signature: Print Name:" & vbcrlf & vbcrlf & vbcrlf & _
"......................... .........................." & vbcrlf & _
vbcrlf & vbcrlf & "Engineers Name: ............................." & vbcrlf & "Assigned By: " & item.owner & vbcrlf & vbcrlf & _
vbcrlf & "Explanation of how " &_
"the issue was resolved: (Any parts used etc)" & vbcrlf & vbcrlf & vbcrlf & vbcrlf & vbcrlf & vbcrlf & _
vbcrlf & vbcrlf & "Added @ " & Now() & vbcrlf & "By: " & Item.owner & vbcrlf & _
jobid
'Item.Update
End If
End Function

Function Item_Close()
mypos = instr(1, item.subject, "#!#")
If MyPos < 1 Then
Item.subject = item.subject & " " & jobid
End If

End Function

This is on a task form in a public folder.
When I try and run this form I get:

"Can't open this item"

any ideas?
 
S

Sue Mosher [MVP]

Nothing jumps out at me. If it were my form, I'd start commenting out code
and republishing.
--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers



I have created a custom form. Code as follows:
(Messy I know, but it does the job)

Function Item_Open()
'Error Handler :p
on error resume next
Dim jobid

'Seed random number generator
Randomize

Jobid = "Unique Job ID:#!# " & Int((99999 * Rnd) + 1)

'Check to see if item already has this.
mypos = InStr(1, Item.body, "#!#")

'If not then stick it on
If mypos < 1 Then
item.body = item.body & vbcrlf & _
vbcrlf & vbcrlf & vbcrlf & vbcrlf & vbcrlf & vbcrlf &
vbcrlf & vbcrlf & vbcrlf & _
"Start Time: ......................... End Time:
.........................." & vbrlf & _
vbcrlf & vbcrlf & "Date:
..................................." & vbcrlf & vbcrlf & vbcrlf & vbcrlf &
vbcrlf & vbcrlf & _
"Please get the customer to complete the following
details on job completion:" & vbcrlf & _
"Signature: Print Name:" & vbcrlf &
vbcrlf & vbcrlf & _
".........................
.........................." & vbcrlf & _
vbcrlf & vbcrlf & "Engineers Name:
............................." & vbcrlf & "Assigned By: " & item.owner &
vbcrlf & vbcrlf & _
vbcrlf & "Explanation of how " &_
"the issue was resolved: (Any parts used etc)" & vbcrlf
& vbcrlf & vbcrlf & vbcrlf & vbcrlf & vbcrlf & _
vbcrlf & vbcrlf & "Added @ " & Now() & vbcrlf & "By: " &
Item.owner & vbcrlf & _
jobid
'Item.Update
End If
End Function

Function Item_Close()
mypos = instr(1, item.subject, "#!#")
If MyPos < 1 Then
Item.subject = item.subject & " " & jobid
End If

End Function

This is on a task form in a public folder.
When I try and run this form I get:

"Can't open this item"

any ideas?
 

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

Top