|
I have found the answer, based on this post - http://www.tek-tips.com/viewthread.cfm?qid=1245332&page=1[^]
My resulting code now looks like this, in case anyone else is interested:
Sub TestHarness
Set objTrans = CreateObject("NameTranslate")
objTrans.Set 3, "<domainname>\<servername>$"
strComputerDN = objTrans.Get(1)
Set objComputer = GetObject("LDAP://" & strComputerDN)
colGroups = objComputer.MemberOf
For i = 0 To UBound(colGroups)
ActiveCell.Value = GetGroup(colGroups(i))
ActiveCell.Offset(1, 0).Select
Next
End Sub
Function GetGroup(strGroup) As String
z = Split(strGroup, ",")
If Left(z(0), 3) = "CN=" Then
GetGroup = Right(z(0), Len(z(0)) - 3)
Else
GetGroup = ""
End If
End Function
|
|
|
|
|
Hi,
Actually i am creating some graphic using SYSTEM.DRAWING namespace in vb.net now every thing is going fine but i Want o make that file as read only means no body can change it in either paint or any else tool.This can be achieved by
System.IO.File.SetAttributes("c:\test.jpg", IO.FileAttributes.ReadOnly)
but doing this way user can change the attribute of file using file properties in windows Xp. I Need help to make the file readonly for ever can any body help me please..
|
|
|
|
|
You shouldn't and probably can't do this. A user owns the machine, or his privileges are set by an administrator that control this. Your application cannot and should not be able to do what you want for obvious reasons...
|
|
|
|
|
sarfarazaliqureshi wrote: I Need help to make the file readonly for ever can any body help me please..
Can't be done. Someone, most notably, an admin, will ALWAYS be able to revert it back to read/write, for any user.
|
|
|
|
|
Embed the image in a protectable document, like PDF or Word, and sign the document. Whilst it doesn't prevent copying, it does prevent other people from making alterations and publishing them under your name. If they alter it, the sign "breaks".
See cacert.org if you want a key.
I are troll
|
|
|
|
|
Hi, i am creating a Winforms UserControl that has a splitcontainer and a couple of labels and textboxes, in the left panel of the splitcontainer are the lables and the textboxes in the right panel, What i want is to be able to change the spliter distance in desing time with the mouse, not changing the property.
all i get now when i drag my usercontrol in a new form is a static picture of my control, and i can't interact with it's contents in any way.
How could i do that?
Thanks in advance
|
|
|
|
|
I'm having a problem figuring out how to programatically activate a second form in a multi-form application using the primary form to activate it. The problem is that I have code set to run when the second form is loaded which I did move to the activated sub but the code did not run. To activate the second form I used the Code Form2.Activate() . Is this code incorrect or am I missing something or am I completely misunderstanding the usage of this sub? I have found another way to successfully start the second form, however, it is by using
Form2.Visible = True<br />
Form2.Visible = False . And this poses a security problem because I do not want the second form to be accessible if a section of the code goes awry. Thanks for you help.
modified 8-Sep-21 21:01pm.
|
|
|
|
|
Activate gives also gives the focus to a form, so it'll immediately spring up so the user can click in and use the form.
You cannot activate a form without showing it first. Activate gives the focus to a visible form, but does nothing if the form is not already visible.
I don't understand what the design problem is or why you're trying to achieve this.
|
|
|
|
|
Hi i'm trying to update a specific table in access by executing an append query.The code i'm using to do so is the following:
Dim SqlCmd As Command
Set SqlCmd = New Command
SqlCmd.CommandType = adCmdText
SqlCmd.ActiveConnection = MyCnn
SqlCmd.CommandText = "Execute CRegSubAdicNulo"
Set RecSet = SqlCmd.Execute(, , adExecuteNoRecords)
As far as i can see i don't see anything wrong,the problem is after executing that piece of code the table doesn't have anychanges
What am i doing wrong?
Thanks in advance!
|
|
|
|
|
Calferreira wrote: SqlCmd.ActiveConnection = MyCnn
Where are you instantiating the connection? (= New Connection)
I are troll
|
|
|
|
|
When the form loads a make a new instance from the connection:
Set Mycnn=New Connection
Mycnn.open blablabla
This 'CRegSubAdicNulo' is an append query made inside access that checks for records and inserts them into a table that will be edited to fill the empty columns.
|
|
|
|
|
Is there any error? What is inside MyCnn? Did you see if the connection is active first, are you able to read and write in other areas of your application?
|
|
|
|
|
I get no error the application runs fine,after executing this code i posted i can use the application normally getting data from the database with no problems.
|
|
|
|
|
Calferreira wrote: This 'CRegSubAdicNulo' is an append query made inside access that checks for records and ...
I guess your problem lies in CRegSubAdicNulo, you should probably start there.
|
|
|
|
|
If i run it manually inside access it runs fine with no problems.
It just displays a warning that the table will be modified and runs ok.
|
|
|
|
|
Well then, check to make sure your connection is established, thats all I can really think of.
|
|
|
|
|
Doing
Msgbox MyCnn.State
Gives me 1 as result so the connection is fine.
|
|
|
|
|
"Append"-queries are weird things. What happens when you try and use a "real" update-query?
I are troll
|
|
|
|
|
Sorry what do you mean by real?Using for exemple the sql code?
|
|
|
|
|
Open the query that your executing in MS-Access, in the "design view". You'll notice that it's an "append"-query, as you mentioned. These queries add the selected records to a table.
If you open the query in SQL-designview, you'll notice that it has a "SELECT INTO". Change the type to a "SELECT"-query - one that doesn't add records to a new table, but that just "selects", nothing more.
You may want to verify your SQL in that particular query
I are troll
|
|
|
|
|
Yup it runs fine.Shows all the records
|
|
|
|
|
If you run the query from VB.NET, as a selection-query (not the append-version), does it work too?
I are troll
|
|
|
|
|
I don't have VB.Net atm only vb6.
Don't know if it helps but the sql code in the query is the following:
INSERT INTO Substancias ( CODINTERNO, NOMESUBSTANCIA, NEC, NCAS, ESTADOFISICO, SECTOR, UTILIZAÇÃO, DENSIDADE, GRAUP, FRISCO, COV, CATSEVESO, QTARM, DATAFICHASEG, FORNECEDOR, ORIGEMFORN )
SELECT Artigos.CODIGO, Artigos.NOME, Substancias.NEC, Substancias.NCAS, Substancias.ESTADOFISICO, Substancias.SECTOR, Substancias.UTILIZAÇÃO, Substancias.DENSIDADE, Substancias.GRAUP, Substancias.FRISCO, Substancias.COV, Substancias.CATSEVESO, Substancias.QTARM, Substancias.DATAFICHASEG, Substancias.FORNECEDOR, Substancias.ORIGEMFORN
FROM Artigos LEFT JOIN Substancias ON Artigos.CODIGO = Substancias.CODINTERNO
WHERE (((Artigos.NOME) Like "acido*" Or (Artigos.NOME) Like "Oleo*" Or (Artigos.NOME) Like "cola*" Or (Artigos.NOME) Like "diluente*" Or (Artigos.NOME) Like "purpurina*" Or (Artigos.NOME) Like "tinta*" Or (Artigos.NOME) Like "verniz*"));
Funny thing is that i tried to execute the sql code directly and the result is the same nothing happens...
modified on Monday, January 12, 2009 10:44 AM
|
|
|
|
|
The question remains; if you run a "select"-query, that only returns those rows (without appending them), does it work?
I are troll
|
|
|
|
|
Yes it returns the rows without adding them to a new table.
|
|
|
|