none
Visualbasic problem RRS feed

  • Question

  • Dear all,

    I have a problem in a structure into my database.

    The string with error is: 

    If Forms!M_01_Opere!TabCtlMain.Value = 1 Then

    All the visualbasic code:

    Private Sub Form_Current()
    If Forms!M_01_Opere!TabCtlMain.Value = 1 Then
            For j = 1 To 5000000
            Next
        If Trim(Collegamento) <> "" Then
            curDrive = Mid$(CurrentDb.Name, 1, 1)
            posNome = InStr(1, CurrentDb.Name, Dir(CurrentDb.Name, 1))
            mdbpath = Mid$(CurrentDb.Name, 1, posNome - 1)
            If [TipoAllegato] = "Disegno tecnico" Then
               Foto.Picture = ""
            Else
               Foto.Picture = mdbpath & Collegamento
            End If
        Else
            Foto.Picture = ""
        End If
    End If
    End Sub

    I have try to resolve this problem but i don't have arrive to a rapid solution.

    I hope that you can help me,

    Best Regard M.
    • Edited by MathewCo Monday, March 21, 2016 9:19 AM
    Monday, March 21, 2016 8:55 AM

Answers

  • No it's not open. I have try to leave open the form M_01_Opere and i don't have problem. 

    What is a method to know if TabCtlMain is a valid control on the form?

    Hi Mathew,

    If the form is open, and your problem is gone, then all is ok.

    In case the form was open, and you still got an error, you had to check the control.

    Imb.

    • Marked as answer by David_JunFeng Wednesday, March 30, 2016 9:38 AM
    Monday, March 21, 2016 10:52 AM

All replies

  • The string with error is: 

    If Forms!M_01_Opere!TabCtlMain.Value = 1 Then

    Hi Mathew,

    The form "M_01_Opere" must be open to retrieve a value. Is it open?

    Is TabCtlMain a valid control on the form?

    Imb.

    Monday, March 21, 2016 9:33 AM
  • Ok, thanks.

    No it's not open. I have try to leave open the form M_01_Opere and i don't have problem, but photographs into my database don't change in the sub mask. I try to resolve this problem.

    What is a method to know if TabCtlMain is a valid control on the form?

    Thanks,

    Mathew



    • Edited by MathewCo Monday, March 21, 2016 10:49 AM
    Monday, March 21, 2016 10:43 AM
  • No it's not open. I have try to leave open the form M_01_Opere and i don't have problem. 

    What is a method to know if TabCtlMain is a valid control on the form?

    Hi Mathew,

    If the form is open, and your problem is gone, then all is ok.

    In case the form was open, and you still got an error, you had to check the control.

    Imb.

    • Marked as answer by David_JunFeng Wednesday, March 30, 2016 9:38 AM
    Monday, March 21, 2016 10:52 AM
  • Ok, thanks. 
    Monday, March 21, 2016 10:55 AM
  • What is the purpose of this? For j = 1 To 5000000
     Next

    Wait for user input?

    If you want a delay you should use a processor-indepent delay:
    Public Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As LongPtr)

    Usage:
    Sleep(10000)


    Best regards George

    Monday, March 21, 2016 3:46 PM