If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
|
Thread Tools | Display Modes |
#11
|
|||
|
|||
setting up access to remote desktop features from within acces
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 "mike147z" wrote: 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 |
#12
|
|||
|
|||
setting up access to remote desktop features from within acces
Mike,
Check your code closely; there is no pipe symbol anywhere in the code. Copy your code and post it here. Steve "mike147z" wrote in message ... 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" wrote: 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" wrote in message ... 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" wrote: 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" wrote: 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. |
#13
|
|||
|
|||
setting up access to remote desktop features from within acces
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. "Clifford Bass" wrote: Hi Mike, If you follow Steve's post, it should solve this issue. Clifford Bass "mike147z" wrote: 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" wrote: |
#14
|
|||
|
|||
setting up access to remote desktop features from within acces
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 "mike147z" wrote: 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. |
|
Thread Tools | |
Display Modes | |
|
|