Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    Join Date
    May 2013
    Posts
    27

    Unanswered: populating fields

    hell everyone. im new at Ms Access. and have a question that can probably be answered pretty quickly.... i've attached my form so that you can fully understand what im trying to do.

    im trying to learn a way to switch the values in a field by using a combo box. or open for any suggestions.. lets say you have a cab company. and you want your driver to pick up Halle Berry and take her to the Music Awards. in my vehicleID i have the field called "pickup" and "dropoff"
    in the pickup field i want to enter an address, and drop off another address..
    ok. well im taking her to the music awards now. so everything is working fine. but my return address and dropoff address needs to auto switch , when she is ready to go home.
    Attached Thumbnails Attached Thumbnails test.png  

  2. #2
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    I've written this type of thing for limo and cab companies. Here's some code to switch fields:

    Code:
      Dim varPuCity        As Variant
      Dim varPuLandmark    As Variant
      Dim varPuStreet      As Variant
      Dim varPuXStreet     As Variant
      Dim varPuPoint       As Variant
    
      'stuff pickup data into variables
      varPuCity = Me.cboPuCity
      varPuLandmark = Me.cboLandmark
      varPuStreet = Me.txtPuAddress
      varPuXStreet = Me.txtPuXStreet
      varPuPoint = Me.txtPuPoint
    
      'copy destination fields to pickup
      Me.cboPuCity = Me.cboDestCity
      Me.cboLandmark = Me.cboDestLandmark
      Me.txtPuAddress = Me.txtDestAddress
      Me.txtPuXStreet = Me.txtDestXStreet
      Me.txtPuPoint = Me.txtDestPoint
    
      'copy pickup to destination from variables
      Me.cboDestCity = varPuCity
      Me.cboDestLandmark = varPuLandmark
      Me.txtDestAddress = varPuStreet
      Me.txtDestXStreet = varPuXStreet
      Me.txtDestPoint = varPuPoint
    Paul

  3. #3
    Join Date
    May 2013
    Posts
    27
    put the code where? in combo box, afterupdate. lol sorry im lost

  4. #4
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    In whatever event(s) you want it to occur.

    I call it from 2 places. I have a button on the form so the user can just flip the addresses if they want. I also have "Save and add return trip" button that would save the reservation on the form, then start a new reservation with the same basic passenger info, flip the addresses and leaves focus in the date field so the user can add the date and time of the return trip. They would then click on a save button that would save the reservation and clear the form.
    Paul

  5. #5
    Join Date
    May 2013
    Posts
    27
    thats awesome, that is exactly what im trying to do.Do you have a dummy form i can just look at so to make sure im doing it right. wow you are indeed a smart person.

  6. #6
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    I've never been good at making things look good, but they work well. Here's a form with the company name blocked out. The yellow fields indicate required fields that aren't filled in yet.
    Attached Thumbnails Attached Thumbnails ResForm.jpg  
    Paul

  7. #7
    Join Date
    May 2013
    Posts
    27
    Thanks Paul you've been a big help.

  8. #8
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    No problem; good luck with the project.
    Paul

  9. #9
    Join Date
    May 2013
    Posts
    27
    Im trying to do a append query that will append one table to another by using weekday criteria instead of date in my schedule database. for example. i want to add mrs johnson schedule for pickup to accure every wednesday and friday.

  10. #10
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    I use a "repeating reservations" table with yes/no fields for the 7 days, plus start and end dates. You can append from there, using the day as a criteria. In some apps I run that nightly to add reservations for the next day. In a limo app, they plan farther ahead so on the first of each month the process adds reservations for 2 months out.
    Paul

  11. #11
    Join Date
    May 2013
    Posts
    27
    so i create a table with only yes and no fields? or 7 day fields "example mon-sun" with yes/no as data types..lol im lost.. so do i stiil make a table with all new reservation on it , so i can append them. or do i use table already created..

  12. #12
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    I'm sure there are any number of ways to do it. You could just draw from the repeating table and not create "regular" reservations. I create a regular reservation from the repeating reservation (in other words, 2 tables). Given your example, I would have created a reservation for Wednesday 7/31 and another one for Friday 8/2 this week. Next week I'd create two more. My repeating reservation table has all the normal fields for name, address, etc, plus the pickup time, 7 yes/no fields and the 2 effective date fields.
    Paul

  13. #13
    Join Date
    May 2013
    Posts
    27
    ill give it a try and let you know the outcome.... thanks again

  14. #14
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    Happy to help.
    Paul

  15. #15
    Join Date
    May 2013
    Posts
    27
    I did the switch corretly , but still dont know how to add the second leg of the trip by using save button.. im lost. I'm even willing to add a 3rd leg if possible. can you explain what im doing wrong. i made a copy of my pickup address and dropoff address which is text104 and text106 , and created a button.. my code for that button is if me."button name" = true then me.text104.enabled=true me.text106=true end if..then set enable in my properties menu to no... but still same result. only one record is added..

Posting Permissions

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