Embedded image (1 Viewer)

John Sh

Member
Local time
Today, 12:00
Joined
Feb 8, 2021
Messages
36
I have a 5 x11cm login sub form with an embedded image. It has worked fine for some time but suddenly the image has gone full screen while the form's controls are their normal size and operate as required. This seems to happen while modifying code outside of the login form. I have tried reversing recent code changes to no avail. If I open a backup copy of the form all is normal. Opening the login form without the parent produces the full screen image.
I am 81 years old and learning vba so things do slip past some times.
Any suggestions!
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 19:00
Joined
Oct 29, 2018
Messages
15,548
Hi. Is there any way you could post a copy of the form in question?
 

John Sh

Member
Local time
Today, 12:00
Joined
Feb 8, 2021
Messages
36
Hi. Is there any way you could post a copy of the form in question?
That's a bit awkward and wouldn't show much. I have since found that copying a good copy of the login form over the bad one fixes the problem. So the error is somewhere in the form settings or the code. I am currently comparing both to see where there is a difference. I will post my findings, if I find something.
Thanks for your interest.
John
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 19:00
Joined
Oct 29, 2018
Messages
15,548
That's a bit awkward and wouldn't show much. I have since found that copying a good copy of the login form over the bad one fixes the problem. So the error is somewhere in the form settings or the code. I am currently comparing both to see where there is a difference. I will post my findings, if I find something.
Thanks for your interest.
John
Hi. Glad to hear you got it sorted out. Good luck with your project.
 

John Sh

Member
Local time
Today, 12:00
Joined
Feb 8, 2021
Messages
36
Hi. Glad to hear you got it sorted out. Good luck with your project.
Well, I know what but I have no idea why.
I have a public boolean variable called "bLabel". It is used throughout my code to keep track of whether, or not, a particular message has been put out. It turns out that if I assign "true" to this variable in the code for the login form all hell breaks loose. In a test just now the login did not appear at all and the main form froze. I had to use the task manager to close Access. Previously every thing worked but the image was full screen. Removing that variable does not correct the problem so it mut be affecting something deeper down. I have attached the code for the login form. The errant variable was placed above the "setfocus" command in the "onload" subroutine. If I copy a working version of the form over a faulty one, everything comes back to normal. I have cross checked all of the form properties and they are identical as far as I can see.
The "undeclared" variables are declared as public in a module.
John

Code:
Option Compare Database
Option Explicit


Private Sub txtPassword_AfterUpdate()
    Dim rs As Recordset
    Dim num As Integer
    Me.lblNoPass.Visible = False
    Set rs = CurrentDb.OpenRecordset("login", dbOpenSnapshot, dbReadOnly)
    rs.FindFirst "First = '" & Me.cboLogin & "'"
    intLevel = rs!Level
    strLogin = rs!First
    strFullName = Trim(rs!Last) & ". " & Left(rs!First, 1) & "."
    If Me.txtPassword = Null Or Me.txtPassword = "" Then
        Me.lblNoPass.Visible = True
        GoTo Cleanup
    End If
    num = StrComp(rs!Password, Me.txtPassword, 0)
    If num <> 0 Then
        Me.lblNoPass.Visible = True
        GoTo Cleanup
    End If
    Me.lblNoPass.Visible = False
    DoCmd.Close acForm, Me.Name
    Call setLevel([Forms]![main collection])
    Call nameIt(strLogin)
    Call noShow("A")
Exit Sub
Cleanup:
    Me.cboLogin = ""
    Me.txtPassword = ""
    Me.cboLogin.SetFocus
End Sub




Private Sub cboLogin_Click()
    Me.lblNoPass.Visible = False
    If Me.cboLogin = "Student" Then
        strLogin = "A student"
        DoCmd.Close acForm, Me.Name
        DoCmd.OpenForm "Main Collection", acNormal
        [Forms]![main collection]![txtAccNo].SetFocus
        intLevel = 3
        Call setLevel([Forms]![main collection])
        Call nameIt(strLogin)
    End If

End Sub

Private Sub Form_Load()
   bLabel = true
   [Forms]![loginfrm]![cboLogin].SetFocus
End Sub
 
Last edited:

Users who are viewing this thread

Top Bottom