access 2007 where condition in Buttons linking between two forms - database

For a simple borrowed item database, I am trying to link two forms together via a button 'Return'
However, the button does not apply a filter to the correct Item.
In the main menu their is a subform that shows the list of borrowed item via a Query. The list of borrowed Items is a continuous form with the button 'return'
The following event is used when the button is clicked:
OpenForm
form nameReturn
View Form
Data mode Edit
window mode Normal
searchforrecord
object type form
object name return
record First
Where condition = ="[Item_ID]="&[Item_ID]
In that situation access does not apply a filter, after some tutorials I discovered another methode and tested it.
OpenForm
form nameReturn
View Form
Where condition = ="[Item_ID]="&[Item_ID]
Data mode Edit
window mode Normal
in that situation a filter is applied but it does not find any records. Could anyone help in what i did wrong to find link the two forms that use the same table?

Related

Disable form filter using expression MS Access

So on one form I have a button than opens a filtered form based on a combobox on the previous form. Works fine. But on the opened form I also have combobox for selecting records - which doesn't work when the form is filtered. I would want to disable the filter when user selects record in that combobox.
Is there a way to disable the form filter using expression in onChange event?
For example:
=[FilterOn]=False
or
=[Filter]=""
These don't work for me though.
Thanks
Cannot be an expression like that in event property. Could build a VBA custom public function with code to neutralize filter and call function in event property. It would be complicated because have to pass form name or form object as argument of function =ClearFilter("formnamehere"). I have not developed function code and really don't think this is best approach.
In most cases, when OnChange event is used, really should be AfterUpdate.

Opening Button to open form based on combo box selection

I currently have a MS Access database of members.
I have a form that has a combo box which is populated with just the first and last names of members. (using a test database for now)
What im struggling with is how do i create a button that opens another form i have created but using the selection in the dropdown box to populate the fields in the newly opened form.
When a user from the dropdown box is selected an open is clicked i want it to open the profile form populated with their details.
pictures and access files can be found on my ftp server:
ftp://ftp.legends-gym.co.uk
User: ftpuser#legends-gym.co.uk
Pass: ftpuser
Regards
I can't access ftp site from work so can't see what you've got thus far however, the key bits you want to look at here are:
Add a button to the form and the On Click Event to open your profile form. Something along the lines of docmd.openform "frmProfile", acNormal
You need something to pass the member you've selected in the combo box to the profile form. One way might be to use OpenArgs so have a look at that
You then could use the passed variable in OpenArgs to select the data you want to fill out your profile form.
EDIT...
OK, I've had a look at the file now. Here is what you need to do to fix your problems (and a couple of extra bits which aren't causing an issue but will improve the look and feel).
On the Format of the Home form and the Member Search form, set Navigation Buttons and Record Selector to false. - This removes the unnecessary elements for a "single" form, you're not looking at records.
On the member search form, remove the binding to the members table. - You don't need to bind this form, as the recordsource of the combo is pulling the data required separately. if you look at your form before you change it, you'll notice you've got 1 of 10 records...
Also, remove the filter criteria and set filter on load to No - You were filtering the wrong form.
On the combo box, remove the after update event. - I'm not sure what that was trying to do but its completely unnecessary.
On the command button, add an onclick event which has the following code DoCmd.OpenForm "Profile", acNormal, , "ID = " & Me.Combo361 & ""
Save everything and enjoy. :)
You weren't far wrong with the filter, but it's actually a WHERE clause when opening another form - sorry, my bad misdirection. What you were doing was filtering the original form - ie the member search form. Also, you don't need to put ' quotes around the ID, it's a number not a string.
If you have problems I can probably host this fixed version somewhere for you to download.

Creating new UI controls programmatically in visual c++

I have just started using visual studio c++ (2010) with windows forms, but have cannot for the life of me find out how to create new UI items in response to events. What I would want to happen is click a button, and have a new row, with a couple of text boxes and buttons appear, with onebutton to delete the row if I keep clicking, more rows will appear, named row0, row1 etcv. I looked at this page, (http://msdn.microsoft.com/en-us/library/aa984255(v=vs.71).aspx), about adding controls programmatically, but when I add a new text box inside a click event, the text box is only created inside the scope of the event (as expected!), but I want to be able to create it insde the newRow click event, but access it and . I thought of making a 'row' class, with row.text and row.deleteButton properties, and at each creation of a row, respective events will be created for button clicks and text edits.
Is there anyway to do this, ie a function that can be created that creates new objects by passing the required name?
The trick for this to work is that you need to have declarations outside of the event handler to keep track of the newly added UI components. In the link you've given the added TextBox is locally scoped within the event function, and this will be removed from the heap (i.e. memory) when the event is finished.
So one solution would be to add a list of UI components to your form, and then have the events add to or remove from this list of components. To get this solution working you possibly need to read up on lists of objects (or possibly dictionaries) and how to handle these.
Sorry for a rather general answer, but the question is also very broad... :)

Apex radio button check from controller

I have a scenario and i ma getting no where:
I am having 20 record and i m using pagination via standartcontroller and my page size is 1.
one by one record are displayed on the screen and i am having a list or radio button to select options.
When user select a radio button i am getting its value and fill a map with record,value for some processing.
What i want to do is that when a user hits back button the option he has selected in radio button must be visible there. But its not coz every time i m filling new values in the radiobutton list so old values are not sustained.
What i want is when user hits back button he should be able to see the old radio button selected.
How can i achive this:
1.Is there any way to make a radio button list's values be checked through controller.
2.Do I need to use wrapperclass to do this.
Help needed.! Thanks
It will be easier to put this field into object. If you don't have such field in you sObject than I would suggest to create wrapper class in your controller and display list of this wrappers instead of your native sObject.
If your radio button field is already part of the object, then there's no need for a wrapper class, but if the radio button doesn't need to be part of the object then use a wrapper class to keep the object simple.
Check out this example of a wrapper class with check boxes.
Wrapper classes don't have to be complex.

Conditional Formatting based on layout view

Another question for you Filemaker Pro experts. The database I am developing starts with a Main layout with a number of buttons (e.g. insert new item, show all items, etc.). Each button is associated to a script, which takes the user to the relevant layout. In each of these layouts I show the buttons in a row, and highlight the current layout with inverse colour.
My problem is that some of the buttons lead to the same layout, viewed in different modes, and I don't know how to conditionally highlight the right button.
For instance, Insert new item and Show all items take to the same layout, however in the first case the script views the layout as a form and inserts a new record, while in the second I view as a list and show all records. The layout is the same, though, so I'd need to enact a conditional formatting based on something. How do I do that, and what should I check against?
Thanks in advance for any help.
Regards.
Presumably you are currently using the formula: Get (LayoutName) to decide on your conditional formula, why not try additionally using formulas: Get(WindowMode) and Get(LayoutViewState)?
You could conditionally format the button if (which sends user to MyLayout in browse mode):
Get(WindowMode)=0 and Get(LayoutName)="MyLayout"
Or (which sends user to MyLayout in form view):
Get(LayoutViewState)=0 and Get(LayoutName)="MyLayout"
.
Other functions which may help could be Get(FoundCount) and Get(TotalRecordCount). You can see the entire list of Get functions here.

Resources