Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2004

    Unhappy Unanswered: very wierd - form will not open on a phone number that starts with 201

    I have a search form that takes a phone number then opens up the main form.

    It works perfect except for phone numbers that start with "201"

    ex. 2015551212

    If I change the phone number to 2515551212, it works! So I know the problem is not an autonumber or some other issue.

    The error is the standard "Run time error 2757 problem accessing a property or method of the OLE object"

    Does anyone have a clue?

  2. #2
    Join Date
    Apr 2004
    Only with 201? Are you possibly located in area code 201? Check your windows settings. If it is a phone number field that could be a reason... but a real wild shot in the dark.

  3. #3
    Join Date
    Mar 2004

    Thanks for the reply Winston, but no...

    I am not in 201 area code. I should have mentioned that this is an .adp using Access 2000 and SQL 2000. Both current on updates.

    I am having the user recreate the whole table jsut in case there was something corrupt. I don't know what else to try really.

    here is the code behind the search form

    Private Sub cmdCancel_Click()
    DoCmd.OpenForm ("frmMenu")
    'DoCmd.Close (Form.frmSearch)
    Exit Sub

    End Sub

    Private Sub cmdOK_Click()

    Dim MyMsgBox As VbMsgBoxStyle
    Dim stDocName As String
    Dim stLinkCriteria As String

    Dim cnn As ADODB.Connection
    Dim rst As ADODB.Recordset
    Set cnn = CurrentProject.Connection
    Set rst = New ADODB.Recordset
    rst.Open "sprocPhonesOnly", cnn, adOpenDynamic, adLockPessimistic

    rst.Find "[phone] = '" & Me![pubPhone] & "'"

    If IsNull(pubPhone) Then 'record empty
    MsgBox ("You must enter a phone number.")
    Exit Sub
    End If

    If rst.EOF Then
    MyMsgBox = MsgBox("That phone number is not in the database. Do you want to add it?", vbCritical + vbYesNo, "Record Not Found")

    If MyMsgBox = 6 Then
    stDocName = "frmNewBor"
    DoCmd.OpenForm stDocName, , , stLinkCriteria
    End If
    ' Me.pubPhone = Null
    ' Me.pubPhone.SetFocus

    DoCmd.OpenForm ("frmMainQuickApp")

    End If

    Set rst = Nothing
    Set cnn = Nothing


    End Sub

    Private Sub Form_Open(Cancel As Integer)
    pubPhone = Me.pubPhone
    End Sub

    and here is the code behind the main form

    Private Sub Form_Open(Cancel As Integer)


    Dim varID As Variant
    Dim strSQL As String

    varID = Forms!frmSearch.Form!pubPhone
    strSQL = "SELECT * FROM dbo.vewPhone WHERE phone = (" & varID & ")"

    Me.RecordSource = strSQL

    'Me![frmCoBor].Form!.Visible = False

    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts