replace line of vba code during split form front end deployment (1 Viewer)

Hutchy

Registered User.
Local time
Today, 11:59
Joined
Jun 28, 2013
Messages
42
I need some help, please.

So, I have a database that I've split and have deployed to 7 persons.
The thing is, I have three (3) forms:

Form 1
Form 2
Form 3

...that require changing a portion of a line in each form's respective VBA codes. I need to change the directories to where an excel workbook is stored after exporting, and another is where same excel is moved to after being uploaded.

At the moment, during deployment I have to manually change the directories.

I was thinking of maybe a pop-up form with four (4) fields that allows the user to select his/her name at the start-up of their frontend app, and paste the directories in the other text boxes provided.

This information will then be used to replace the directories in the VBA.

If I were to make changes and have to redeploy, I would have to do everything manually again.

Does that makes sense?
Any advice?
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 09:59
Joined
Aug 30, 2003
Messages
36,127
I wouldn't look at it from a "change the VBA code" perspective, I'd write the VBA to use the variable info, like:

"C:\Blah\" & VariableInfo & "RestOfPath"

You can grab the Windows login name if that's the correct value, or use your form.
 

Hutchy

Registered User.
Local time
Today, 11:59
Joined
Jun 28, 2013
Messages
42
I wouldn't look at it from a "change the VBA code" perspective, I'd write the VBA to use the variable info, like:

"C:\Blah\" & VariableInfo & "RestOfPath"

You can grab the Windows login name if that's the correct value, or use your form.

Thanks for responding :)

I think grabbing the windows login name is a great idea - if possible :)

I would have...

Code:
wbook.SaveAs Filename:="C:\Users" & WindowsLogin & "\Documents\Project\Timesheets (Generated)\" & Me.ProjectID & "_" & Me.EmployeeName & "_" & Me.TimePeriod & ".xlsx"
wbook.Close

I would have to create the folder on all machine at that particular directory.

What do you think?

Is there a way to know their directory to Documents without having to put it myself?

Also, I'm new to the splitting database feature... If I have an update, do I update a copy of the front end and then give each a copy of it?
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 09:59
Joined
Aug 30, 2003
Messages
36,127
Several ways to grab the Windows user:

CreateObject("wscript.network").UserName
Environ("username")
http://access.mvps.org/access/api/api0008.htm

I think they'll have a folder in Users, but I've never tried to use it. I typically have a folder I create on new PC's and use for all of this type of thing.
 

Hutchy

Registered User.
Local time
Today, 11:59
Joined
Jun 28, 2013
Messages
42
Okay, so tried this in my code on my machine and it works... will try it at work.
Thanks!
Code:
LoginName = CreateObject("wscript.network").UserName
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 09:59
Joined
Aug 30, 2003
Messages
36,127
Should be irie mon!

I'm sure I misused that. :p
 

Users who are viewing this thread

Top Bottom