Results 1 to 6 of 6

Thread: Help on Several Things

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2001
    Location
    Washington DC
    Posts
    330

    Help on Several Things

    I am using Access 2000 only. A front end and backend.

    1) I have a form bound to a query. When the form opens I want it to open to blank fields not the data in the first or last record of the query.

    2) I am rceiving an error "2465:Application-defined or Object-Defined Error. I do not know what thius means, and I can not identify.

    3) Code to add one hour to the time value in a text box and populate another text box.

    4) Someone with a brain for transplant. Mine is fried. hehe
    Swoozie
    Somedays you just should not get out of bed.

  2. #2
    Frenzied Member PilgrimPete's Avatar
    Join Date
    Feb 2002
    Posts
    1,313
    1. Take a look at the DataEntry property (on the Data tab).
    2. Where is the error occurring? What are you doing when it happens?
    3. [in the ControlSource of your target textbox] =DateAdd("h",1,[originalField])
    4. Mine's all gone too. Sorry. Too much Access programming!

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2001
    Location
    Washington DC
    Posts
    330
    Thanks, I solved issue 2 and4 will never be solved.

    The data Entry property doesnt help, because I change the record source through out the program

    And thanks for the time I could not remember how to do it.
    Swoozie
    Somedays you just should not get out of bed.

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2001
    Location
    Washington DC
    Posts
    330
    Please look over the code. I am not sure what I am doing wrong. I am trying to take a time (9:00am) and add one hour to it.

    It isnt working.

    Dim arrival As Date
    Dim EndTime As Date

    If Not IsNull(Me.txt_ArrivalTime.Value) Then
    arrival = (Me.txt_ArrivalTime.Value)

    'Me.txt_ArrivalTime.Value is 9:00 am
    'Arrival is returning a value of 12:00 am

    EndTime = DateAdd("h", 1, [arrival])
    MsgBox (EndTime)
    Me.txt_EndTime.Value = EndTime
    End If
    Swoozie
    Somedays you just should not get out of bed.

  5. #5
    Frenzied Member PilgrimPete's Avatar
    Join Date
    Feb 2002
    Posts
    1,313
    VB/VBA handles time in a slightly annoying way in that it is a Date/Time. Therefore, you might have to give it a dummy date. Try this:
    VB Code:
    1. Dim arrival As Date
    2.     Dim EndTime As Date
    3.    
    4.     If Not IsNull(Me.txt_ArrivalTime.Value) Then
    5.         arrival = CDate("1/1/2001 " & CStr(Me.txt_ArrivalTime.Value))
    6.        
    7.         'Me.txt_ArrivalTime.Value is 9:00 am
    8.         'Arrival is returning a value of 12:00 am
    9.        
    10.         EndTime = DateAdd("h", 1, arrival)
    11.         MsgBox (EndTime)
    12.         'Me.txt_EndTime.Value = Format(EndTime, "hh:nn AM/PM")
    13.     End If

    Glad you got 2 sorted. Are you still looking for a solution to 1?

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2001
    Location
    Washington DC
    Posts
    330
    I actually figured out the time thing in myself last night while I slept. Dreams are good for something.

    I converted it to a sigular number added then passed it back to a time format. Worked great.

    number one, I still havent solved. I am just making the user click the >* button at the bottom of the form untill I can figure out something else.
    Swoozie
    Somedays you just should not get out of bed.

Posting Permissions

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



Click Here to Expand Forum to Full Width