Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    char is offline Novice
    Windows Vista Access 2010 32bit
    Join Date
    Oct 2012
    Posts
    29

    showing field dependent on previous field in a form

    I have a table called welding, I want to create a user friendly form for input. The database ultimately wants to go on share point so I am building it in the web database option.


    One of the fields is called location, if the location is 'Field' I want 10 more fields to appear for data entry such as weld reason, rail temperature etc . If the location is 'Depot' I want these fields to be hidden as they aren't relevant.
    Is this possible? and how would I do this?
    New to access and this is really frustrating me. Appreciate any help.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    You have to program with macros instead of VBA.

    Need code to set the Visible or Enabled properties of controls.

    Code in form Current event to set properties when form opens or move to another record.

    Also code in Location control AfterUpdate event to hide or unhide controls if value changed.

    I use only VBA so not sure how macros do this. So look into coding those events with Embedded or regular macros.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    char is offline Novice
    Windows Vista Access 2010 32bit
    Join Date
    Oct 2012
    Posts
    29
    thanks for the response,
    I am not sure what to do with the macros, I had a go using the IF macros but I couldn't get it to work. Any ideas what I would enter into the macros?

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    No, I would have to learn and experiment just as you need to. I don't use macros although I can sometimes debug them. However, I can't anlayze a web database.

    Does this help http://msdn.microsoft.com/en-us/libr...ffice.11).aspx

    Make attempt and when you have issues provide us something to analyze in a new thread.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    char is offline Novice
    Windows Vista Access 2010 32bit
    Join Date
    Oct 2012
    Posts
    29
    no i am afraid that doesn't make much sense to me, I have been attempting this for a few days now but I have never used Macros before. I have done a after event but nothing happens and I have tried an IF but there is no option to show more fields. Very confused.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    I was able to test this much, the link helped me a little.

    From the form OnCurrent event I double clicked the ellipses (...) and selected Macro builder. Macro settings:

    If: Location="Field" :Then
    Action: SetProperty
    Control Name: your textbox1 name
    Property: Visible
    Value: False
    Action: SetProperty
    Control Name: your textbox2 name
    Property: Visible
    Value: False
    Add Else
    Action: SetProperty
    Control Name: your textbox1 name
    Property: Visible
    Value: True
    Action: SetProperty
    Control Name: your textbox2 name
    Property: Visible
    Value: True

    Not so bad, but still prefer VBA.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    char is offline Novice
    Windows Vista Access 2010 32bit
    Join Date
    Oct 2012
    Posts
    29
    Thank you very much for your help, when I run this it says "Microsoft Access cannot find the name 'Location' you entered in the expression.
    Location is in my table and appears on my form, the field doesn't derive from any other table either so I am not sure why it isn't running!

  8. #8
    char is offline Novice
    Windows Vista Access 2010 32bit
    Join Date
    Oct 2012
    Posts
    29
    ah I have sorted it now. Thank you very much for your assistance it is greatly appreciated.

  9. #9
    char is offline Novice
    Windows Vista Access 2010 32bit
    Join Date
    Oct 2012
    Posts
    29
    I thought I had, the message is actually still coming up, tried altering the name of the field and tried it on another form, whichever field I used it seems to be coming up with the message 'Microsoft Access can not find..." Any suggestions?

  10. #10
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Is there a subform involved? Is Location also the name of the control bound to the Location field?

    I didn't need to in my test, but try prefixing the field/control name with the form qualifer:
    Forms!formname.controlname.

    Rats! I can't review web databases. You might be on your own from here.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  11. #11
    char is offline Novice
    Windows Vista Access 2010 32bit
    Join Date
    Oct 2012
    Posts
    29
    no sub form involved and I don't think it is control bound but i'm not too sure what that means. I have tried the form qualifer and it says "Microsoft Access cannot parse the expression, click ok to return to the action argument or expression then correct the syntax"

  12. #12
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Bound control means it has a ControlSource that is a field in the form RecordSource.

    Why don't you try with a non-web database for learning. You can provide that db and I can review it. If we get that working for you then you can go back to the challenge of web database.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  13. #13
    char is offline Novice
    Windows Vista Access 2010 32bit
    Join Date
    Oct 2012
    Posts
    29
    I started making it as a normal database, went to see if it was compatible to upload and it had about 100 issues so I restarted using the web designer so that I wouldn't have any compatibility issues.
    I have tried adding the form and name to every set property and now the message:
    "The SetProperty action or method failed because there was no form or report context"

  14. #14
    char is offline Novice
    Windows Vista Access 2010 32bit
    Join Date
    Oct 2012
    Posts
    29
    online weld.zip

    Attached so you can have a look what I have tried so far!

  15. #15
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    I cannot review web database. I can't open objects in design view therefore I cannot look at the macros.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. need to check a field for previous record in form
    By clemdawg in forum Programming
    Replies: 1
    Last Post: 06-13-2012, 07:17 PM
  2. Replies: 2
    Last Post: 07-14-2011, 09:23 AM
  3. Make new field based on previous field's answer
    By VictoriaAlbert in forum Access
    Replies: 1
    Last Post: 04-11-2011, 09:54 PM
  4. Populate field from field on previous record
    By randolphoralph in forum Forms
    Replies: 7
    Last Post: 03-04-2011, 11:28 AM
  5. Replies: 4
    Last Post: 02-08-2011, 08:43 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums