coping database then VDA seem to stop working (1 Viewer)

rainbows

Registered User.
Local time
Yesterday, 20:34
Joined
Apr 21, 2017
Messages
425
hi , i have copied a database from on location to another of which i have done many times before with no problem but lately i am having problems for example this screen below opens up when the database is open and i select the department i want and it asks me for a password via (VBA) which has worked many times yet i have copied it again to another folder it dont let me select a department , yet the original one still does. i have put another macro on the form and that works m so it seems the VBA some some reason is not working. any help apprecaited

1654502099696.png
 

Gasman

Enthusiastic Amateur
Local time
Today, 04:34
Joined
Sep 21, 2011
Messages
14,238
Check the code.
I used to make a check that the FE was in the required location.
If not I would send a warning message and close the DB. Your code might just allow read access?
 

rainbows

Registered User.
Local time
Yesterday, 20:34
Joined
Apr 21, 2017
Messages
425
Code:
Private Sub Command369_Click()

Dim strInput As String
Dim strMsg As String

Beep
strMsg = "Please Enter  the password to allow access."
strInput = InputBox(Prompt:=strMsg, Title:="Sales Password")
If strInput = "Steve5" Then
MsgBox "Password accepted! Welcome!     " & "Stephen Rouse"
DoCmd.OpenForm "sales orders"
DoCmd.Close acForm, Me.Name
ElseIf strInput = "Mandy9" Then
MsgBox "Password accepted! Welcome!     " & "Mandy Wells"
DoCmd.OpenForm "sales orders"
DoCmd.Close acForm, Me.Name
Else 'password is incorrect
MsgBox "Incorrect Password!" & vbCrLf & vbLf & "You are not allowed access to the ''sales form''.", vbCritical, "Invalid Password"
Exit Sub
End If
End Sub


[CODE]Private Sub Command369_Click()

Dim strInput As String
Dim strMsg As String

Beep
strMsg = "Please Enter  the password to allow access."
strInput = InputBox(Prompt:=strMsg, Title:="Sales Password")
If strInput = "Steve5" Then
MsgBox "Password accepted! Welcome!     " & "Stephen Rouse"
DoCmd.OpenForm "sales orders"
DoCmd.Close acForm, Me.Name
ElseIf strInput = "Mandy9" Then
MsgBox "Password accepted! Welcome!     " & "Mandy Wells"
DoCmd.OpenForm "sales orders"
DoCmd.Close acForm, Me.Name
Else 'password is incorrect
MsgBox "Incorrect Password!" & vbCrLf & vbLf & "You are not allowed access to the ''sales form''.", vbCritical, "Invalid Password"
Exit Sub
End If
End Sub
End Sub[/CODE]


the first code is from the one working , the second code is the one which is not . yet they are the same
 

CJ_London

Super Moderator
Staff member
Local time
Today, 04:34
Joined
Feb 19, 2013
Messages
16,610
2 questions:

1. is the file in a trusted location?
2. have you tried stepping through the code to make sure it works?
 

rainbows

Registered User.
Local time
Yesterday, 20:34
Joined
Apr 21, 2017
Messages
425
1654511713692.png

the step over is not highlighted so i dot know how to check the code . yes they are a trusted location
 

CJ_London

Super Moderator
Staff member
Local time
Today, 04:34
Joined
Feb 19, 2013
Messages
16,610
the step over is not highlighted so i dot know how to check the code
you need to open the form and click on the button. Usually you would put the breakpoint on the first line of code (Beep in this case)
 

rainbows

Registered User.
Local time
Yesterday, 20:34
Joined
Apr 21, 2017
Messages
425
the problem is nothing happens when i press any of the buttons on any form . that are using vba , but if use a macro it works
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 11:34
Joined
May 7, 2009
Messages
19,229
go in Design view of your form.
click on the troubled button.
click the Click three dots (...) on the click event.
does it brings you to the correct code?

delete Everything in the Click event.
press the three dots (...) on the Click event and Choose
Code builder.
 

rainbows

Registered User.
Local time
Yesterday, 20:34
Joined
Apr 21, 2017
Messages
425
yes it takes me to the correct code
when deleted and chose code builder it brings me back to the same code

1654517245607.png
 

Pat Hartman

Super Moderator
Staff member
Local time
Yesterday, 23:34
Joined
Feb 19, 2002
Messages
43,233
What does "one location to another" mean? Are you talking about one drive to another or are you talking about running the application from a different computer?

It is always possible that the database is corrupted. You can try the decompile to see if that works.

PS, when you add a control to a form, ALWAYS give it a rational name. Command369 is meaningless and no one looking at the code would have any clue what the procedure is supposed to do without reading it. AND reading it is made more difficult by the lack of code formatting.

PPS, If you want people to log in, define a person table with login credentials. Match what they type in the login form to what is stored in the table. This is not something to hard-code. There is no security plus you have to do maintenance every time you get a new user.
 

rainbows

Registered User.
Local time
Yesterday, 20:34
Joined
Apr 21, 2017
Messages
425
i am not on the server i have the database in one of my folders in my documents and it works and i use it to check any updates anyone wants before i update the one on the server . , if i copy that file thats in my folder or try and do a save as then that new copy will not work
 

rainbows

Registered User.
Local time
Yesterday, 20:34
Joined
Apr 21, 2017
Messages
425
1654542542967.png

now i have selected this . it now all works ok. have i selected the correct one as this states "not recommended " ?
 

Pat Hartman

Super Moderator
Staff member
Local time
Yesterday, 23:34
Joined
Feb 19, 2002
Messages
43,233
So, copying the file from a folder on your computer to the server raises and error? OR the copy succeeds. Then when you try to open the file from that folder you get an error?

You're also going to need to tell us what "does not work" means as well as any error messages.
 

Pat Hartman

Super Moderator
Staff member
Local time
Yesterday, 23:34
Joined
Feb 19, 2002
Messages
43,233
What ActiveX control are you using and where did you get it? You have to be very careful with programs you didn't write yourself and that is what the heightened security is about.

Instead of changing the ActiveX setting, you might be able to define the server based folder as a trusted location. That requires an additional check in a checkbox so you can allow trusted locations on a server. If that works for you, then all the others need to make the same modification to their trusted locations OR, if you have IT support, they can push that setting to all users of your application so you don't have to worry about it.
 

rainbows

Registered User.
Local time
Yesterday, 20:34
Joined
Apr 21, 2017
Messages
425
i have a data base on my laptop that is not connected to the server and all works ok . we also have another database( same as mine on my laptop ) that is on the server and has been split and all works ok so both working ok . independant of each other . if the users want an upgrade to the one on the server firstly i will take a copy of the one on my laptop . not the one on the server. previously when i took a copy of the one on my laptop i had no issues and all 3 databases worked ok . for some reason today i told another copy of the latest copy ( ie now 4 databases ), 3 on my laptop and one on the server. the latest one on my laptop that i took today i tried to use and nothing would work ( ie all VBA ). so i changed the active x settings and now it works
 

Pat Hartman

Super Moderator
Staff member
Local time
Yesterday, 23:34
Joined
Feb 19, 2002
Messages
43,233
So, you never tried my suggestion regarding trusted folders. You also never answered the questions regarding the Active-X.

Glad everything is working fine.
 

rainbows

Registered User.
Local time
Yesterday, 20:34
Joined
Apr 21, 2017
Messages
425
i have now created a trusted folder and all is ok

thank you all for helping me as i was worried i could not get them to work

steve
 

CJ_London

Super Moderator
Staff member
Local time
Today, 04:34
Joined
Feb 19, 2013
Messages
16,610
trusted folders were mentioned in post #4 - taken a further 13 posts for that to be applied
 

Users who are viewing this thread

Top Bottom