Hello All,
1) I have made word file as user manual of my application & I want to add it in my project (MDI form's Help menu), so howcan I do that ?
2) Is there we can write committrans & rollback for ADO & How ?
Printable View
Hello All,
1) I have made word file as user manual of my application & I want to add it in my project (MDI form's Help menu), so howcan I do that ?
2) Is there we can write committrans & rollback for ADO & How ?
Quote:
Originally Posted by shirishdawane
VB Code:
Dim cn As ADODB.Connection Set cn = New ADODB.Connection cn.ConnectionString = "Your connection string" cn.Open 'Then you can use these.. cn.BeginTrans cn.CommitTrans cn.RollbackTrans
Suppose I am adding new record in multiple linked tables in one shot & data saved into 1st table but due to error unable to save into 2nd table then can cn.Rollback undo changes done into table1 ?
Yes, you can. General idea:Quote:
Originally Posted by shirishdawane
VB Code:
Private Sub ExecuteTransaction() Dim cn As ADODB.Connection Dim blnTransOpen As Boolean Dim ConnectionLiving As Boolean On Error GoTo ErrHandler blnTransOpen = False ConnectionLiving = False Set cn = New ADODB.Connection cn.ConnectionString = "Your connection string" cn.Open ConnectionLiving = True cn.BeginTrans blnTransOpen = True cn.Execute "Insert Into Table1..." cn.Execute "Insert Into Table2..." cn.CommitTrans blnTransOpen = False cn.Close ConnectionLiving = False Set cn = Nothing Exit Sub ErrHandler: If blnTransOpen Then cn.RollbackTrans MsgBox "Error when trying to Insert data", vbOKOnly + vbCritical, "Error:" End If If ConnectionLiving Then cn.Close Set cn = Nothing End If End Sub
Thanx jcis :thumb: , but what about 1st que. ? if you know the answer, ofcourse. :)
I think you need OLE to add a Word document to your Form, I never used Ole, just opened word or Excel files from VB, but that's different than what you need.
Maybe it's not a good idea to add a word document, If I would have to add help to my program, I would use a RichTextBox, it accepts Formatting, or maybe the Advanced label control that Joacim Andersson added to VB Codebank.
I think the real problem about Word, besides that OLE insertion you need, is that it won't work if the user hasn't word installed in that PC.
Thanx for your valuable information. :wave:
You're welcome ;)Quote:
Originally Posted by shirishdawane
[QUOTE=jcis]Maybe it's not a good idea to add a word document, If I would have to add help to my program, I would use a RichTextBox, it accepts Formatting, or maybe the Advanced label control that Joacim Andersson added to VB Codebank./QUOTE]
Hello jcis but I have searched Code Bank forum but unable to find thread which you have mentioned if you know the link then please sende it across. :wave:
Ok, this is the thread..Quote:
Originally Posted by shirishdawane
http://www.vbforums.com/showthread.php?t=379724
But now I realize that you'll need to scroll your document and don't know if that control supports scrolling. You can do it if you use a RichTextBox.
I think a Richtextbox would be the best option then, but I've just tryied to insert an OLE object and it's easy, but again, I don't know how it should be programmed to be scrolled.If you want to try, just select the OLE component in the tool window and drag it to your Form, it will show its properties, then select browse, and select your DOC file there.
I have done as per you have said & geuss what when you double click on OLE object at runtime then linked Word file is getting open. So no need to write anything for OLE object scrolling.Quote:
Originally Posted by jcis
The RichTextBox is the best option, this will open and show your word documents with scrollbars..
1) In word, save your documents as RTF, it gives you that option when you click Save As..
2) Add Microsoft Rich TextBox control 6.0 to your project. Drag it to the form and in Scrollbars property select both. Right click the control, properties and select From File, there you load your RTF file.
That's all, you don't even need code, and you can use that documents you created with Word.
EDIT Oh ok, you did it with OLE, you can try also this option to see how it works, then use the one you like the most.
Hey jcis really thanx from heart, today I really learn so many things from you. Keep guiding in future also. Thank you once again. :wave:
You're welcome mate :wave:
ps: I forgot, set RichTextBox's Locked property to True, so the control won't be editable for users.