Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all articles
Browse latest Browse all 13329

Alter code to use field found in another Form

$
0
0
Using the code below in Access 2010 works great with the current Form I've been using.

Code:

Private Sub Command1043_Click()

On Error GoTo Err_cmdExplore_Click

Dim stAppName As String

stAppName = "C:\Windows\explorer.exe D:\Clients\" & Me.txtContactName & "\"
Call Shell(stAppName, 1)
If Dir("D:\Clients\" & Me.txtContactName & "\") = "" Then
MsgBox "Folder not found."
Else
Exit_cmdExplore_Click:
Exit Sub

Err_cmdExplore_Click:
MsgBox Err.Description
Resume Exit_cmdExplore_Click

End If

End Sub

I decided to move the button to a different Form, and now it fails because it can't find the txtContactName field.

The new Form I moved it to, does not have the field, txtContactName. How can I rewrite this so it can find the txtContactName field from the Form that does have it?

The name of the Form that has the field is named Main and the new Form I moved it to is named ContactDetails.

I assume I need to change this line of code but not sure how to accomplish this:
Code:

stAppName = "C:\Windows\explorer.exe D:\Clients\" & Me.txtContactName & "\"

Thank you
Mike

Viewing all articles
Browse latest Browse all 13329

Trending Articles