Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2012
    Posts
    22

    Unanswered: the expression on current you entered as the event property

    Please help with this error, everytime i open a form from my switchboard and i click on one button(suppose to open another form) it throws the attached message on picture. My VBA code is :

    Option Compare Database

    Private Sub AddAppointment_Click()
    Dim rsAppointments As Recordset
    Dim strTime As String
    Dim dtTime As Date

    strTime = Form_AppointmentInformation.cboHour & ":" & Form_AppointmentInformation.cboMinute

    Set rsAppointments = CurrentDb.OpenRecordset("Select * from Appointments")
    rsAppointments.AddNew
    rsAppointments.Fields(1) = Form_AppointmentInformation.AppointmentDate
    rsAppointments.Fields(2) = Form_AppointmentInformation.cboHour & ":" & Form_AppointmentInformation.cboMinute

    End Sub

    Private Sub Form_BeforeUpdate(Cancel As Integer)
    If RecordsetClone.RecordCount = 2 Then
    MsgBox "Client made enough bookings and now qualifies for free voucher."
    End If

    End Sub

    Private Sub Form_Load()
    If RecordsetClone.RecordCount = 3 Then
    Me.AllowAdditions = True
    Me.AllowEdits = False
    End If
    End Sub
    Attached Thumbnails Attached Thumbnails OnCurrent Error.JPG  

  2. #2
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Sadly I've seen this problem literally dozens of times, over the years, in just about every known version of Access, and the causes are too numerous to list here! The culprits usually blamed are
    1. Having an ActiveX Control that is corrupted or not registered
    2. A Corrupted Form or entire Database
    3. Security settings set too high
    4. Norton Anti-Virus installed, in some configurations


    The solution to #1 is to identify the errant ActiveX Control and re-register it. This is frequently impossible to do, and re-installing Access itself is often the only solution. I'd try this last!

    The answer to #2 can be as easy as creating a new, blank file and importing all Objects into it. This is what I'd do first.

    For the answer to #3, have a look at this KB article

    You may receive an "A problem occurred while Microsoft Access was communicating with the OLE Server" error message when you try to embed or link a Word document in Access

    Linq ;0)>
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  3. #3
    Join Date
    Apr 2012
    Posts
    22
    Thanks Linq - I have done compact and repair DB and it is sorted...

    Now how here is a quick thing - I added a new "add record" button and this time i am controlling it using the macro, it saves data to its table but does not clear thereafter, so i have to manualy remove what was typed in. How can i add another macro to add record to table and the clear it off the list boxes or fileds ?

  4. #4
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Glad you got your first problem solved!

    If this is a Bound Form you just need to move to a New Record to 'clear' the Form.

    In point of fact, Access automatically saves the Current Record, in Bound Forms, when moving to another Record or a New Record, and thus really needs no 'Save' or 'Add Record' button.

    In the future, please start a new thread when you have a new problem, with an appropriate title. This will increase the chances of you getting a solution to it.

    Linq ;0)>
    Linq ;0)>
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

Posting Permissions

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