Results 1 to 5 of 5
  1. #1
    Join Date
    May 2004
    Posts
    133

    Wink Unanswered: put date from inputbox into oneform

    here is my inputbox (of A form's load event):
    With Me.deptsafetyList
    .RowSource = _
    " Select employeeid, Firstname, department, fullname, birth, hiredon from Employees " & _
    " where department is not null " & _
    " order by department,firstname "
    .BoundColumn = 1
    .ColumnHeads = True
    .ColumnCount = 6
    .ColumnWidths = "0.8 in;0;1.1 in;0.9 in;0;0"
    .Requery
    End With
    End Select

    on double click of inputbox event, I added this code:
    Dim Emp As String
    Dim brth As Date
    Dim hiredo As Date
    Emp = Me.deptsafetyList.Column(0)
    brth = Me.deptsafetyList.Column(4)
    hiredo = Me.deptsafetyList.Column(5)
    DoCmd.OpenForm "accidentdetail", acNormal
    DoCmd.GoToRecord , , acNewRec
    Forms!accidentdetail!EmployeeID = Emp
    Forms!accidentdetail!birth = brth
    Forms!accidentdetail!Hiredon = hiredo

    But when I double clicked on listbox, "type missmatch" error appeared.
    Could you helped me to solve the problem?
    please helped me, I need your help. Many thanks

  2. #2
    Join Date
    Feb 2005
    Location
    England.
    Posts
    232
    When you open up the accidentdetail form, what are the objects Emp, brth and hiredo?

  3. #3
    Join Date
    May 2004
    Posts
    133
    thank you for the question and sorry: I'm late.
    in accidentdetail form:
    emp is employeeid textbox (control source is set to employeeid field in accidentdetail table)
    brth is birth textbox.
    hiredo is hiredon textbox.

    Do you want me to post my file for you?
    many thanks

  4. #4
    Join Date
    May 2004
    Posts
    133
    I found the problem:
    My code is true (when I double clicked in the listbox, the accident detail form is opened with no problem) if in my listbox (not inputbox, sorry for my typing mistake) birth and hiredon is not null, if one of them is null, "type missmatch" error appeared.
    So, how can I handle this error when I double click my listbox, it still open accident detail form, and leave birth and hiredon textbox in this form blank?
    many thanks

  5. #5
    Join Date
    Feb 2005
    Location
    England.
    Posts
    232
    My suggestion would be to test for null values, something like ...

    If Forms!accidentdetail!EmployeeID Is Null Then

    Do Something

    ElseIf Forms!accidentdetail!birth Is Null Then

    Do Something

    ....

    and so on.

    My suggestion would be to either prompt the user for this info, or simply not pass these values over to the new form, hence no chance of the mismatch.

    Hope this helps.

Posting Permissions

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