Results 1 to 11 of 11
  1. #1
    mkenyon2 is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Mar 2012
    Posts
    20

    Question 2010 Web Database Form questions

    I have an Access Web Database (generated by Sharepoint) with an Assets table. I have a link my Assets DataSheet that opens a form for Maintenance, but not bound to the table. The form has 3 fields, Type (a combo based on the MaintType table), Details, a textbox, and a hidden field, AssetID (to be populated by the Asset who'd link the user clicked).



    Also, in this form, I have a subform, with a datasheet view of the Maintenance table.

    1st) I would like the subform to be filtered, based on the value in the AssetID field. How can I bind that way?

    2nd) In this Maintenance form, I have a 'Save Record' button. When clicked, I want it to take the values from the 3 fields, and create a new Maintenance record. I have a NamedMacro on the Maintenance table that creates a new record, but it doesn't seem to like the value coming from the combo box.

    I've tried googling, perhaps I'm not searching for the correct terms.

  2. #2
    mkenyon2 is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Mar 2012
    Posts
    20
    Part 1 I did by the main form setting the Filter (SetFilter) value on the sub form.

    Part 2, still having trouble. On my save button, I can get the ID/number of the selected item, but when passing it to my named macro, I do a SetField using a parameter on the macro, and get the message:
    The field 'TypeOfMaint' cannot accept the data type supplied by SetField.

    TypeOfMaint is a lookup field.

  3. #3
    ram is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2012
    Posts
    2
    The question is what type of data is accepting the lookup field when coming from SetField the ID (number) or the actual type (text). To solve a similar problem what i did is create a query that had the actual type (text) not the ID (number) and use those values to populate the look up field and worked.

  4. #4
    mkenyon2 is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Mar 2012
    Posts
    20
    Hmmm... so the data macro would call a query that searched for the item and passed that into the value? Interesting...

  5. #5
    mkenyon2 is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Mar 2012
    Posts
    20
    K, when I do that, I get 'Failed to filter result'

  6. #6
    mkenyon2 is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Mar 2012
    Posts
    20
    Trying this:

    Description Context
    Failed to filter result. LookupRecord MaintenanceType, =ID=FormatNumber(SearchID,0),


    What gives? SearchID = 4 which is a valid ID in the MaintenanceType table.

  7. #7
    mkenyon2 is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Mar 2012
    Posts
    20
    So, I have a 'FindMaintType' data macro
    One parameter, SearchID
    LookupRecord Where [ID] = [SearchID]
    SetReturnVar FoundType = [MT].[Type] (Type is the column with the name)
    But LookupRecord seems to be failing. If I change it to [ID] = 4 it works.

  8. #8
    mkenyon2 is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Mar 2012
    Posts
    20
    here's an interesting thing:
    LookupRecord Where [ID] = FormatNumber(4,0)
    fails.

  9. #9
    mkenyon2 is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Mar 2012
    Posts
    20
    LookupRecord Where [ID] = Trim(4)
    fails

    All with Failed to filter...
    WHAT THE ....

  10. #10
    mkenyon2 is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Mar 2012
    Posts
    20
    If I pass a hard-coded 4 to the macro with this:
    LookupRecord Where [ID] = [SearchID]
    It also works.

  11. #11
    mkenyon2 is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Mar 2012
    Posts
    20
    Okay, I solved it, but I don't like the solution.

    I do:
    SetTempVar (TempMaintType, [MaintTypes] + 0)
    RunDataMacro (MaintenanceRequired.MaintReqdNew, [Forms]![MREdit].[AssetID],[TempVars]![TempMaintType], [Forms]![MREdit].[DetailsText])

    and it works.

    FormatNumber must convert it to a decimal or float, and its expecting an Int. Just passing the value probably went through as a string.

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

Similar Threads

  1. General Questions about Access 2010
    By jack0987 in forum Access
    Replies: 2
    Last Post: 01-29-2012, 01:09 AM
  2. Replies: 1
    Last Post: 01-05-2012, 02:34 PM
  3. Replies: 2
    Last Post: 08-29-2011, 03:36 AM
  4. Database of Maths Questions
    By akash2824 in forum Access
    Replies: 2
    Last Post: 05-01-2011, 06:05 AM
  5. First Database Questions...
    By qu1ckdry in forum Database Design
    Replies: 0
    Last Post: 03-01-2010, 09:33 AM

Tags for this Thread

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