Started form doesent work (1 Viewer)

Mihail

Registered User.
Local time
Today, 21:42
Joined
Jan 22, 2011
Messages
2,373
@ JHB (again)
I've write an Stop statement as the very first statement, in order to break the cod at that point.
Again NOTHING. This tell me that the form events are not triggered.
 

JHB

Have been here a while
Local time
Today, 20:42
Joined
Jun 17, 2012
Messages
7,732
@ JHB (again)
I've write an Stop statement as the very first statement, in order to break the cod at that point.
Again NOTHING. This tell me that the form events are not triggered.
The stop statement does not work, sorry I've tried by myself.
But I will not argue with you about it, so good luck.
 

Mihail

Registered User.
Local time
Today, 21:42
Joined
Jan 22, 2011
Messages
2,373
@JHB
Well... huge apologies.
I see it working but still I don't understand why ?????

Can you perform one more test for me ?

Remove the error handler, rename the BE then try again.
Is this time working ????

Thank you very much !!!!!!!
 

JHB

Have been here a while
Local time
Today, 20:42
Joined
Jun 17, 2012
Messages
7,732
@JHB
Well... huge apologies.
I see it working but still I don't understand why ?????

Can you perform one more test for me ?

Remove the error handler, rename the BE then try again.
Is this time working ????

Thank you very much !!!!!!!
The problem is the Dir which throws an error, (when the drive/folder isn't found), the program just stop, the database doesn't open the startup form, because of the way it is setup.
Attached is the database with the error handling comment out, (then "nothing happen" again!).
 

Attachments

  • Calcul Without errorhandling.zip
    268.6 KB · Views: 92

vbaInet

AWF VIP
Local time
Today, 19:42
Joined
Jan 22, 2010
Messages
26,374
Looks like JHB has spotted your issue. No point in me looking then ;)
 

Mihail

Registered User.
Local time
Today, 21:42
Joined
Jan 22, 2011
Messages
2,373
Thank you all for the help.
Even if I don't fully understand what happen here, at least I'll know how to handle this issue in the future.
Thank you again !!!!
 

Mihail

Registered User.
Local time
Today, 21:42
Joined
Jan 22, 2011
Messages
2,373
Thank you JHB

Look:
After I established first time the link between BE and FEs (by using the error handler provided by you) I closed the FE (Calcul), I renamed the BE and I used other FE (Definire) in order to (re)link the FEs to this "new" BE.
Note please that the FE named "Definire" don't contain your error handler.
This time all work like a charm.

I made one more test:
Again I renamed the BE (so... I have a new BE) and I put this "new" DB in other drive (this time in D:/), also I removed your error handler from the "Calcul" FE.
When I double click the "Calcul" FE... surprise: it work.

Looks like the entire DB (3 FEs and 1 BE) is now, somehow, accommodate with my laptop.

This is the fact that I can't understand.

More fog in my brain:
Why, the same DB work from the beginning (from the first time) on my desktop computer ?
What are the differences ?
Now I suppose that should be something regarding the drives structure.

Hope to understand after more tests.
 

JHB

Have been here a while
Local time
Today, 20:42
Joined
Jun 17, 2012
Messages
7,732
The problem comes when the database is send to you, because you and your client doesn't have the same drive/path where the BE database is running from at your clients computer.
Like me, I do not have the below (picture) drive and path, (the picture shows where the BE last was connected from), therefore the Dir function throws an error, program stops etc.

If you first have connected the FE with the BE then your code runs okay without errorhandler even if you rename the BE.
Next time your client send you a database, open it holding the shift key down and run your form, watch the value of ExpectedPath!
 

Attachments

  • PathMI.jpg
    PathMI.jpg
    14.6 KB · Views: 224

Mihail

Registered User.
Local time
Today, 21:42
Joined
Jan 22, 2011
Messages
2,373
Very useful to know.
Thank you one more time, JHB.
 

JHB

Have been here a while
Local time
Today, 20:42
Joined
Jun 17, 2012
Messages
7,732
You're welcome, good luck. :)
 

Mihail

Registered User.
Local time
Today, 21:42
Joined
Jan 22, 2011
Messages
2,373
Also, just trying to understand your process - if you are the developer, why have your clients got an accdb with access to the code which they are emailing to you, shouldn't they have an accde? and you have the master copy?

Not sure if a new thread is required here, because I have a new issue:
If I make .accde files I'm not able to relink the FEs (all 3 from a single one as I do with .accdb files).

Have you any solution ?
Thank you !
 

CJ_London

Super Moderator
Staff member
Local time
Today, 19:42
Joined
Feb 19, 2013
Messages
16,553
If I make .accde files I'm not able to relink the FEs
I haven't tried to do that for 3 FEs from one FE but my accde FE's can each relink their tables in a similar way to yours - (i.e. browse to the new db). Accde does not prevent users from messing around with tables or queries, only the code, so not sure why you can't make it work.

But I suppose my main point is 'why are they sending you the front ends anyway?' - you have the master copy, if they report a bug I don't see how them sending the FE back helps - you would fix your master copy and send them a revised FE
 

vbaInet

AWF VIP
Local time
Today, 19:42
Joined
Jan 22, 2010
Messages
26,374
Not sure if a new thread is required here, because I have a new issue:
... when in doubt create a new thread.

CJ_London makes a good point... why are they sending you the FEs? And what do you mean by you can't relink your FEs anyway?
 

JHB

Have been here a while
Local time
Today, 20:42
Joined
Jun 17, 2012
Messages
7,732
Not sure if a new thread is required here, because I have a new issue:
If I make .accde files I'm not able to relink the FEs (all 3 from a single one as I do with .accdb files).

Have you any solution ?
Thank you !
You mean the dialogbox isn't shown the files with the .accde extensions?
If yes because you've set the filter to only show files with .accdb and .mdb extensions.

Code:
    sFilter = "Access 2003 ([B][COLOR=Red]*.accdb[/COLOR][/B])" & Chr(0) & "[B][COLOR=Red]*.accdb[/COLOR][/B]" & Chr(0) & _
      "Access 2007 ([B][COLOR=Red]*.mdb[/COLOR][/B])" & Chr(0) & "[B][COLOR=Red]*.mdb[/COLOR][/B]" & Chr(0)
 

Mihail

Registered User.
Local time
Today, 21:42
Joined
Jan 22, 2011
Messages
2,373
@CJ.
I get your point, CJ, and I explained WHY in post #19.
On short because, at that time, I haven't enough knowledge to deal with accde.
Now I like to do this but still I need help.

@vbaInet.
OK. Next time or... if you are able, split, please, this thread for me.

@All
Is a need to have all 3 FEs linked to the same BE at ANY time.
And is very easy for a user to make mistakes by using different BEs in different FEs.
In order to avoid this, when the user hit the "Schimba baza de date" button (in English: Change the database) (you can see such a button in first form of each FE) the code automatic link all FEs to the same BE.

@JHB
I tested of course, to change the extension names (from accdb to accde) but does not work for accde.
More, no error message here but the BE is not changed.

@CJ
Yes. the code work for each FE (accde) but not for all 3 at a time.
 

JHB

Have been here a while
Local time
Today, 20:42
Joined
Jun 17, 2012
Messages
7,732
..
@JHB
I tested of course, to change the extension names (from accdb to accde) but does not work for accde.
More, no error message here but the BE is not changed.
Are you able to choose an .accde database in the dialogbox, or what is it exactly what not work?
 

Mihail

Registered User.
Local time
Today, 21:42
Joined
Jan 22, 2011
Messages
2,373
The dialog box don't ask for a FE. It ask for the BE.
So... lets try to explain better:

How the DB work now:
Open a FE (any of them = 3 possibilities)
Code:
 IF this FE do NOT point to a BE THEN
   the "z_CheckLinkToBackEnd" form is displayed
ELSE
   the first form in logic tree is displayed
End IF
In the first form (other than "z_CheckLinkToBackEnd") is a button: "Schimba baza de date" (=Change the BE)
When the user click this button, the "z_CheckLinkToBackEnd" form is displayed and the user can point to other BE.
So, the dialog box ask (only) for a BE (accdb format).

After the user select the desired BE, a new dialog box is displayed in order to prompt the user to close the FEs (except the current one) then, the code, (see the code in "z_CheckLinkToBackEnd") will link ALL 3 FEs to the selected BE.

If the FEs are in accdb format the code work OK (try it by using the same BE but with different names (BE1, BE2 ... )
but, if FEs are in accde format, the code will properly link the current FE to the selected BE but the other two FEs are not affected.

Do you understand now ?
If not, feel free to ask more. I know the limitation of my English.
 

JHB

Have been here a while
Local time
Today, 20:42
Joined
Jun 17, 2012
Messages
7,732
I don't know if you already have found the problem, but else!
The problem lays in the Function ReConnect, where you exceptional specifies to look for databases with the file extension .accdb!

Code:
 ...       
Dim FEfolder, FEname As String, FEpath As String

     FEname = "\Definire[B][COLOR=Red].accdb[/COLOR][/B]"
        FEfolder = CurrentProject.Path
        FEpath = FEfolder & FEname
    If IsDatabaseRunning(FEpath) Then
        MsgBox ("""Definire"" este inca deschis" & Chr(13) & Chr(13) & _
                "(re)conectarea nu este posibila")
Exit Function
    End If
    
    FEname = "\Citiri[B][COLOR=Red].accdb[/COLOR][/B]"
        FEfolder = CurrentProject.Path
        FEpath = FEfolder & FEname
    If IsDatabaseRunning(FEpath) Then
        MsgBox ("""Citiri"" este inca deschis" & Chr(13) & Chr(13) & _
                "(re)conectarea nu este posibila")
Exit Function
    End If
   
'(Re)link other(s) Front End database(s)
    'First of my FE, named Definire.accdb
    FEname = "\Definire[B][COLOR=Red].accdb[/COLOR][/B]"
        FEfolder = CurrentProject.Path
        FEpath = FEfolder & FEname
        Set DB = OpenDatabase(Name:=FEpath)
    GoSub RelinkThisFE

    'Second of my FE, named Citiri.accdb
    FEname = "\Citiri[B][COLOR=Red].accdb[/COLOR][/B]"
        FEfolder = CurrentProject.Path
        FEpath = FEfolder & FEname
        Set DB = OpenDatabase(Name:=FEpath)
    GoSub RelinkThisFE
    
    'All is Ok
    ReConnect = True
 

Mihail

Registered User.
Local time
Today, 21:42
Joined
Jan 22, 2011
Messages
2,373
Thank you JHB, CJ and all of you
Finally it work and now I have a beautiful DB with .accdb files and the users has the .accde FEs.
Thank you again !
 

Users who are viewing this thread

Top Bottom