Results 1 to 12 of 12
  1. #1
    ItsRoland is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jun 2018
    Posts
    111

    Enter Parameter Value Prompt for Value That's Properly Referenced

    I'm probably missing something simple here, but I've been scratching my head at this one for a while now so hopefully someone here can point out what it is.



    I've got a continuous form called 'fsubEditPorts' that's based on a query which contains information about network ports on devices, i.e. what the port is called, what the IP address is, the port and device it's connecting to, etc.

    On fsubEditPorts is a text box called txtIDdev that's linked to the field 'ID_device'(the device the port is connecting to), and a combo box called cmbIDport that's linked to the field 'ID_port'(the port being connected to). These fields won't always have a value in them because not every port on every device is in use.

    My goal is, if a user wants to change what port is being connected to they can use cmbIDport to see a list of all the ports on the destination device and pick the one they're looking for.

    To do this I set criteria in the row source of the combo box to only show ports tied to a device with the same ID as 'txtIDdev'.
    Code:
    [Forms]![fsubEditPorts]![txtIDdev]
    This resulted in an 'Enter Parameter Value' prompt for '[Forms]![fsubEditPorts]![txtIDdev]'. I assumed this was because txtIDdev was null in some records, so in the query that fsubEditPorts is based off of I set ID_device to be 0 if there was no value for it. This worked fine, 0's are in that field where there would normally be nothing, and 0 will never match an actual device ID.

    I assumed this would cause the combo box to be blank in these records since the query would find no matches for 'ID_device = 0', and fill properly on the rest.

    However, I'm still getting the same error "Enter Parameter Value '[Forms]![fsubEditPorts]![txtIDdev]'" when I open the form. I can't seem to figure out why, since txtIDdev will always have a value in it. If anyone knows what I'm missing please let me know.

    I apologize if I rambled a bit here and gave a lot of useless information. On the flip side, if more information is needed I'd be happy to provide it. Thanks in advance!

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    combobox and textbox are both in fsubEditPorts? This is a subform? That is wrong syntax for referencing a subform. Must reference through subform container control. I always name container different from object it holds, like ctrPorts.

    Forms!Mainform!ctrPorts.Form.txtIDdev

    Which will fail if form is opened independent.

    Just reference textbox without form qualifier.

    SELECT field FROM table WHERE somefield = [txtIDdev];
    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
    ItsRoland is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jun 2018
    Posts
    111
    Yes they are both in fsubEditPorts. Yes, this is a subform, but the parent form isn't effecting anything on it which is why I didn't mention anything about that. Everything I've been talking about is happening within fsubEditPorts.

    I went into the SQL view of cmbIDport's row source query and changed it to match what you have. I'm not getting the 'Enter Parameter Value' message anymore, but the cmbIDport has no values now, regardless of record. The syntax I had that you said is wrong is the same way I'm doing it on other forms, which all currently work fine. Maybe I'm missing something as to why that's incorrect, but I digress.

    Getting rid of the WHERE statement populates cmbIDport normally. I can confirm that txtIDdev is populating as it should, and that I haven't misspelled anything anywhere.

    As far as I'm aware, the SQL you posted should work fine. I'm totally lost as to whats causing this.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    The other forms are not subforms?

    The RowSource I describe has worked for me.

    I assume the RowSource an SQL statement directly in the RowSource.

    Maybe delete and rebuild the combobox. I have had to do that.

    If you want to provide db for analysis, follow instructions at bottom of my post.
    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
    ItsRoland is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jun 2018
    Posts
    111
    To answer your question, I thought some of them were subforms but after looking again I guess none of them are. My mistake. Still, nothing involved in the issue is outside of fsubEditPorts so I don't get how it would be any different.

    Regardless, I figured out the cause, but have a different problem now..

    I removed the query expression I built to fill '0' in to ID_device if there was nothing there, and everything started working fine. Not sure why 0 being in one record would effect the results of a different record, but oh well.

    Now for the new problem..

    cmbIDport has 2 columns, 1 being ID_port and 2 being port description. If the column widths property of cmbIDport is 0.5";1.5" it shows the ID and the description in the dropdown, but if I change it to 0";1.5" to hide the ID field and only show the description it goes back to showing nothing entirely. In case it's needed, bound column is 1 (ID_port), Column Count is 2(description), List width is Auto.

    If it's not one thing, it's another I suppose.



    Anyways, thanks for the help so far. Much appreciated.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    When a form or report is installed as a sub object, the referencing path must go through the container control, therefore the original reference failed.

    Conditional comboboxes with alias will not work nice on Continuous or Datasheet form because when filtered, the alias is not available for display with the saved value. This is a very, very common topic with lengthy discussions on how to deal with.
    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
    ItsRoland is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jun 2018
    Posts
    111
    I realize the issue here has changed since I first posted this thread, so if need be I'll make another thread.

    Since you said this was a common topic I did some searching to try and find a solution. While I definitely came across a ton of different problems relating to this, none of them seem to have a solution that will fix my problem, i.e. they mostly say to do what I've already done :/

    Maybe you'll see something obviously wrong that I didn't.

    So the query my combo box (cmbIDport) is based on has ID_port in the first column and the Description in the second column. I've set the following properties to cmbIDport; column count = 2, bound column = 1, column widths = 1.5";1.5", List Width 3".

    With the properties set as I just listed, everything works fine. cmbIDport displays ID_port, and when you click the drop down it shows both ID_port and the description. However, if I set column widths = 0";1.5" no values are displayed anywhere and the drop down has nothing in it.

    I tried to work around this by changing the query so that description is in the first column and ID_port is in the second, then set column widths = 1.5";1.5" again and changed the bound column from 1 to 2 to match the new ID_port location. This also resulted in no values being displayed and nothing in the drop down.


    I appreciate your help, thanks for bearing with me on this one.

  8. #8
    ItsRoland is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jun 2018
    Posts
    111
    I just discovered something new about whats happening..

    So if I use the properties I listed in my post above (the first one's I listed, the ones that work but with the ID value showing) and click on cmbIDport, it shows the ports that it should no problem. But then, if I click on cmbIDport again only this time in a different record, it still shows the ports for the device in the record I last clicked on.

    In case it's not clear, here's an example: If I click cmbIDport in the record tied to device 2, I get the ports for device 2. Then if click on cmbIDport in any other record, it continues to show the ports for device 2. If you close the form and reopen it, then click on say, device 3, you'll get the ports for device 3 but now cmbIDport will have those ports listed in it's drop down menu for every record, even the ones that don't have a value for ID_device.

    Just found this a minute ago, not sure if it helps or not but wanted to share just in case. I've personally never seen this happen before.

  9. #9
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    The combobox has to be requeried when changing record.

    Bing: Access cascading combobox blank

    Review http://www.rogersaccesslibrary.com/f...8_post388.html
    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.

  10. #10
    ItsRoland is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jun 2018
    Posts
    111
    Oh, right, duh. Thanks for pointing that out.

    I ultimately gave up trying to figure out why the values in the combo box don't show up if the ID field is hidden. Settled with editing the fields in a popup form that you open with a button instead of doing it directly in the continuous form.

    If you or anyone else knows why hiding the ID field of the combo box is making it blank, please let me know. I'd much prefer to use the initial method I had in mind than use a popup form to do it.

    Regardless, thanks for the help.

  11. #11
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    I provided a link that should clarify and provides a solution.

    The values don't show because the alias is not what is saved in table. The ID will show when not hidden because that is the value in field. When RowSource is filtered the associated alias is not available.
    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.

  12. #12
    ItsRoland is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jun 2018
    Posts
    111
    Ah, I was confused when I first read that because I was only using one combo box, not filtering a combo box with another combo box, but after re reading it I realized that using a text box to filter a combo box is basically the same concept for all intents and purposes.

    Thanks!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Parameter value prompt
    By templeowls in forum Queries
    Replies: 1
    Last Post: 02-27-2019, 04:17 PM
  2. Replies: 2
    Last Post: 03-12-2014, 11:14 AM
  3. Report Parameter Prompt
    By leamas in forum Access
    Replies: 7
    Last Post: 05-31-2012, 02:07 PM
  4. Replies: 13
    Last Post: 01-10-2012, 09:56 AM
  5. Get parameter prompt
    By yawalias in forum Queries
    Replies: 1
    Last Post: 12-22-2011, 09:25 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