setting up access to remote desktop features from within access

M

mike147z

I have created a nice little database that reflects a floor plan and has a
button to provide info about each computer. I am want to further enhance
this by being able to access each computer via remote desktop by clicking on
a button within my database. Is this possilbe? If not is there another way
i can do this.
 
C

Clifford Bass

Hi Mike,

Try something like:

Shell "mstsc.exe /v:123.456.789.012", vbNormalFocus

or

Shell "mstsc.exe /v:computer.company.com", vbNormalFocus

Type "mstsc /?" in a command prompt to find out other command line
options for the program.

Clifford Bass
 
M

mike147z

i guess i should of mentioned that i am new to vb/ msaccess. where do i
start to put this command into? by the way thanks for the info.
 
C

Clifford Bass

Hi Mike,

You are welcome. That piece of information tells me I need to be a bit
more detailed.

Open the properties window for the button you created. Click in the On
Click line then on the little button with three periods. When prompted
choose Code Builder. This will create an On Click event code section and
take you into the VBA Editor. In it you will want to add something like
this, which assumes your computer's address (IP or xxx.yyy.com) is in a text
box named "txtInternetAddress":

If Nz([txtInternetAddress], vbNullString) <> vbNullString Then
Shell "mstsc.exe /v:" & [txtInternetAddress], vbNormalFocus
End If

Clifford Bass
 
M

mike147z

i did this and this and nothing happened. I went to properties again and
look at the "on click" button and the line was blank. I clicked on the 3
buttons, selected code builder and this is what shows up. Now this button is
a copy of one that i am using somewhere eles. i went into it and deleted the
info from it.

If Nz([xxx.3e.xxx.ee], vbNullString) <> vbNullString Then
Shell "mstsc.exe /v:" & [xxx.3e.xxx.ee], vbNormalFocus
End If

Private Sub Command146_Click()

End Sub


Clifford Bass said:
Hi Mike,

You are welcome. That piece of information tells me I need to be a bit
more detailed.

Open the properties window for the button you created. Click in the On
Click line then on the little button with three periods. When prompted
choose Code Builder. This will create an On Click event code section and
take you into the VBA Editor. In it you will want to add something like
this, which assumes your computer's address (IP or xxx.yyy.com) is in a text
box named "txtInternetAddress":

If Nz([txtInternetAddress], vbNullString) <> vbNullString Then
Shell "mstsc.exe /v:" & [txtInternetAddress], vbNormalFocus
End If

Clifford Bass

mike147z said:
i guess i should of mentioned that i am new to vb/ msaccess. where do i
start to put this command into? by the way thanks for the info.
 
M

mike147z

I also decided to run a complier on it to see what happens and it comes back
with "Compile error: Invalid outside procedure" It doesn't like the bracket
with the ip address in it. thanks for your help.

Clifford Bass said:
Hi Mike,

You are welcome. That piece of information tells me I need to be a bit
more detailed.

Open the properties window for the button you created. Click in the On
Click line then on the little button with three periods. When prompted
choose Code Builder. This will create an On Click event code section and
take you into the VBA Editor. In it you will want to add something like
this, which assumes your computer's address (IP or xxx.yyy.com) is in a text
box named "txtInternetAddress":

If Nz([txtInternetAddress], vbNullString) <> vbNullString Then
Shell "mstsc.exe /v:" & [txtInternetAddress], vbNormalFocus
End If

Clifford Bass

mike147z said:
i guess i should of mentioned that i am new to vb/ msaccess. where do i
start to put this command into? by the way thanks for the info.
 
S

Steve

Hi Mike,

Start by cutting the three lines of code (If to End If) and pasting it
between Private Sub and End Sub. Should look like:
Private Sub Command146_Click()
If Nz([xxx.3e.xxx.ee], vbNullString) <> vbNullString Then
Shell "mstsc.exe /v:" & [xxx.3e.xxx.ee], vbNormalFocus
End If
End Sub

Now open your form, click the button and see what happens.

Steve


mike147z said:
i did this and this and nothing happened. I went to properties again and
look at the "on click" button and the line was blank. I clicked on the 3
buttons, selected code builder and this is what shows up. Now this button
is
a copy of one that i am using somewhere eles. i went into it and deleted
the
info from it.

If Nz([xxx.3e.xxx.ee], vbNullString) <> vbNullString Then
Shell "mstsc.exe /v:" & [xxx.3e.xxx.ee], vbNormalFocus
End If

Private Sub Command146_Click()

End Sub


Clifford Bass said:
Hi Mike,

You are welcome. That piece of information tells me I need to be a
bit
more detailed.

Open the properties window for the button you created. Click in the
On
Click line then on the little button with three periods. When prompted
choose Code Builder. This will create an On Click event code section and
take you into the VBA Editor. In it you will want to add something like
this, which assumes your computer's address (IP or xxx.yyy.com) is in a
text
box named "txtInternetAddress":

If Nz([txtInternetAddress], vbNullString) <> vbNullString Then
Shell "mstsc.exe /v:" & [txtInternetAddress], vbNormalFocus
End If

Clifford Bass

mike147z said:
i guess i should of mentioned that i am new to vb/ msaccess. where do
i
start to put this command into? by the way thanks for the info.
 
C

Clifford Bass

Hi Mike,

If you follow Steve's post, it should solve this issue.

Clifford Bass
 
M

mike147z

i followed your instructions and now i get a runtime error '2465';
Microsoft office access can't find the field '|' (pipe symbol) referred to
in your expression. So i hit the debug button and this is i get. the If Nz
line is highlighted in yellow.

Private Sub Command146_Click()
If Nz([192.168.0.9], vbNullString) <> vbNullString Then
Shell "mstsc.exe /v:" & [192.168.0.9], vbNormalFocus
End If
End Sub

thanks


Steve said:
Hi Mike,

Start by cutting the three lines of code (If to End If) and pasting it
between Private Sub and End Sub. Should look like:
Private Sub Command146_Click()
If Nz([xxx.3e.xxx.ee], vbNullString) <> vbNullString Then
Shell "mstsc.exe /v:" & [xxx.3e.xxx.ee], vbNormalFocus
End If
End Sub

Now open your form, click the button and see what happens.

Steve


mike147z said:
i did this and this and nothing happened. I went to properties again and
look at the "on click" button and the line was blank. I clicked on the 3
buttons, selected code builder and this is what shows up. Now this button
is
a copy of one that i am using somewhere eles. i went into it and deleted
the
info from it.

If Nz([xxx.3e.xxx.ee], vbNullString) <> vbNullString Then
Shell "mstsc.exe /v:" & [xxx.3e.xxx.ee], vbNormalFocus
End If

Private Sub Command146_Click()

End Sub


Clifford Bass said:
Hi Mike,

You are welcome. That piece of information tells me I need to be a
bit
more detailed.

Open the properties window for the button you created. Click in the
On
Click line then on the little button with three periods. When prompted
choose Code Builder. This will create an On Click event code section and
take you into the VBA Editor. In it you will want to add something like
this, which assumes your computer's address (IP or xxx.yyy.com) is in a
text
box named "txtInternetAddress":

If Nz([txtInternetAddress], vbNullString) <> vbNullString Then
Shell "mstsc.exe /v:" & [txtInternetAddress], vbNormalFocus
End If

Clifford Bass

:

i guess i should of mentioned that i am new to vb/ msaccess. where do
i
start to put this command into? by the way thanks for the info.
 
M

mike147z

Thanks,

I followed his instructions and i got a run-time error '2465'; I replied
with the error and the part that was highlighted during the debug.

thanks.
 
C

Clifford Bass

Hi Mike,

What is the name of the field on your form that holds the IP number?
Use that instead of the actual IP in the code. So if the name of the field
is "txtIP_Number" you would have:

Private Sub Command146_Click()
If Nz([txtIP_Number], vbNullString) <> vbNullString Then
Shell "mstsc.exe /v:" & [txtIP_Number], vbNormalFocus
End If
End Sub

Clifford Bass
 
S

Steve

Mike,

Check your code closely; there is no pipe symbol anywhere in the code. Copy
your code and post it here.

Steve


mike147z said:
i followed your instructions and now i get a runtime error '2465';
Microsoft office access can't find the field '|' (pipe symbol) referred to
in your expression. So i hit the debug button and this is i get. the If
Nz
line is highlighted in yellow.

Private Sub Command146_Click()
If Nz([192.168.0.9], vbNullString) <> vbNullString Then
Shell "mstsc.exe /v:" & [192.168.0.9], vbNormalFocus
End If
End Sub

thanks


Steve said:
Hi Mike,

Start by cutting the three lines of code (If to End If) and pasting it
between Private Sub and End Sub. Should look like:
Private Sub Command146_Click()
If Nz([xxx.3e.xxx.ee], vbNullString) <> vbNullString Then
Shell "mstsc.exe /v:" & [xxx.3e.xxx.ee], vbNormalFocus
End If
End Sub

Now open your form, click the button and see what happens.

Steve


mike147z said:
i did this and this and nothing happened. I went to properties again
and
look at the "on click" button and the line was blank. I clicked on the
3
buttons, selected code builder and this is what shows up. Now this
button
is
a copy of one that i am using somewhere eles. i went into it and
deleted
the
info from it.

If Nz([xxx.3e.xxx.ee], vbNullString) <> vbNullString Then
Shell "mstsc.exe /v:" & [xxx.3e.xxx.ee], vbNormalFocus
End If

Private Sub Command146_Click()

End Sub


:

Hi Mike,

You are welcome. That piece of information tells me I need to be
a
bit
more detailed.

Open the properties window for the button you created. Click in
the
On
Click line then on the little button with three periods. When
prompted
choose Code Builder. This will create an On Click event code section
and
take you into the VBA Editor. In it you will want to add something
like
this, which assumes your computer's address (IP or xxx.yyy.com) is in
a
text
box named "txtInternetAddress":

If Nz([txtInternetAddress], vbNullString) <> vbNullString Then
Shell "mstsc.exe /v:" & [txtInternetAddress], vbNormalFocus
End If

Clifford Bass

:

i guess i should of mentioned that i am new to vb/ msaccess. where
do
i
start to put this command into? by the way thanks for the info.
 
M

mike147z

I got it to work by creating a macro and inserting this mstsc.exe /v:"
[xxx.sss.ddd.zzz]. but i was wondering how does your command (the original
one with the Nz in it) work compared to this one? Is your command supposed
to work better?
thanks for your help.
 
C

Clifford Bass

Hi Mike,

Curious: Is your IP field really named xxx.sss.ddd.zzz?

There is not really any significate difference, both are valid. I much
prefer VBA over macros. It is easier to deal with and understand what is
going on. Plus much more flexible. For any one form, all of the code can be
viewed in one window so it is easy to jump around in it, changing stuff. And
you can get an overall view of what is happening.

The "If Nz([txtInternetAddress], vbNullString) <> vbNullString Then"
part merely checks to see if you have an address and only if you do does it
invoke the Remote Desktop program. The Nz(item, value) function checks to
see if item is null or zero and if it is returns the second item. I use that
since you cannot compare null to anything and get a meaningful result. You
also could use:

If IsNull([txtInternetAddress]) Or [txtInternetAddress] <> "" Then

Clifford Bass
 

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