Problem with Auto Number

J

Josianne

Hi, I look over the discussion groups and I find the answer for my question:
Can we do auto number for a form? But Now I've got and other proble. All
explanation are form contact group, me I want to look on the textbox
NoOfDemand on all of my form task in folder Task on Outlook.
When I press the "Last number" button I want the VBscript to look over all
my task take the last instense on my NoOfDemand and do+1 and put it on my
textbox.
I replace the two first line of code with those one:
olfolderRegistry = 3
olFolderTasks = 17
But I'm very not sure that's ok.
I hope you can help me asap.
Thanks,
 
S

Sue Mosher [MVP-Outlook]

No one knows what code you're referring to.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
S

Sue Mosher [MVP-Outlook]

I don't see any code on that page that matches your description, but you can look up Outlook constants in the object browser. Press ALt+F11 to open the VBA environment in Outlook, then press F2. Switch from <All Libraries> to Outlook to browse all Outlook objects and their properties, methods, and events. Select any object or member, then press F1 to see its Help topic.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers


Josianne said:
Ok Sorry, It's becauise at be begining you have to declare what is the name
of your form and these things:eek:lfolderRegistry = 3, olFolderTasks = 17. For
the form name I'm sure it's ok but for the olfolder I'm not sure it's the 17
and for the olfolderregistry =3 I don't know what it is.
I found this code on:
http://www.outlookexchange.com/articles/ricardosilva/vbscriptoutforms.asp
thanks
--
 
J

Josianne

That was the code I was taking about:

1.olFolderRegistry = 3
2.olFolderContacts = 10
3.myFormName = "FormName"

4.Sub Item_Open()
5. ' Set the Outlook NameSpace
6. Set olns = Application.GetNameSpace("MAPI")
7. ' Set the folder to the Contacts folder
8. Set myFolder = olns.GetDefaultFolder(olFolderContacts)
9. ' #1/1/4501# is Outlook's internal representation of an empty data
value.
10. If Item.LastModificationTime = #1/1/4501# Then
11. ' Item is a brand new item
12. MsgBox "New Item"
13. If Item.Mileage = "" Then
14. ' We're creating the first item in the folder
15. Item.Mileage = 1
16. Else
17. ' Increment the index in the Mileage field
18. Item.Mileage = CStr(CInt(Item.Mileage) + 1)
19. End If
20. ' The following 3 lines re-publish the form to the Contacts
folder with the
21. ' new index number in the Mileage field.
22. Set myForm = Item.FormDescription
23. myForm.Name = myFormName
24. myForm.PublishForm olFolderRegistry, myFolder
25. Else
26 ' Item is an existing item
27. MsgBox "Existing Item, doing nothing"
28. End If
29.End Sub

at the begining you can see:eek:lFolderContacts = 10 if I want the task folder
can I write olFolderTasks = and what is this number that I can write.
and between line 15,16 ans 18,19 can I write something like :NoOfDemand
=Item.Mileage to see what is the value incement?

Thanks a lot, I try to look up in vb help but I've got a message saying that
no help is available for this subject.
 
S

Sue Mosher [MVP-Outlook]

That was the code I was taking about:
1.olFolderRegistry = 3
2.olFolderContacts = 10
3.myFormName = "FormName"

at the begining you can see:eek:lFolderContacts = 10 if I want the task folder
can I write olFolderTasks = and what is this number that I can write.

Please refer to my earlier post about how to use the object browser. That's where you'll find the enumerations, not in Help. Just search the Outlook library for olFolderContacts and you'll find it and the constant values for other default folders.
and between line 15,16 ans 18,19 can I write something like :NoOfDemand
=Item.Mileage to see what is the value incement?

NoOfDemand=Item.Mileage

would return the value of the Item.Mileage property to a variable named NoOfDemand. For more basics on Outlook property syntax, see http://www.outlookcode.com/d/propsyntax.htm
Thanks a lot, I try to look up in vb help but I've got a message saying that
no help is available for this subject.

If you don't have VBA Help installed, you can rerun Office setup and add that component.
 
J

Josianne

Ok I've found that I was right with my olFolderTasks and the constant is 13
.... so my code is ok but when I press the button and I try to look in my
textbox to see the number incremented then then textbox is empty . I try with
another textbox and it's the same tings I'm not able to put a value into a
text box with code I always need to put it on initial value on the property
window of the textbox.
Thanks,
 
S

Sue Mosher [MVP-Outlook]

What text box are you looking at? The code you posted provides no clues.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers


Josianne said:
Ok I've found that I was right with my olFolderTasks and the constant is 13
... so my code is ok but when I press the button and I try to look in my
textbox to see the number incremented then then textbox is empty . I try with
another textbox and it's the same tings I'm not able to put a value into a
text box with code I always need to put it on initial value on the property
window of the textbox.
Thanks,
 
J

Josianne

I try to output my value to a normal textbox. On my form I put a new textbos
control and I try to put my result on it. But I can't do it
 
S

Sue Mosher [MVP-Outlook]

Do you want this value to be saved with the item? Did you bind the control to an Outlook property at the top of the Value tab of the control's Properties dialog? If not, do so. If so, what property? See http://www.outlookcode.com/d/propsyntax.htm for a primer on Outlook property syntax.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
J

Josianne

Sue Mosher said:
Do you want this value to be saved with the item?
I just want to put the value of the mileage value into my textbox(just to
view what is this value).
Did you bind the control to an Outlook property at the top of the Value tab of the control's Properties dialog?
Yes I bind it to a text item
Thanks,
Josianne
 
S

Sue Mosher [MVP-Outlook]

So, what Outlook property are you using for your control?

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 

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