I'm trying to create a database that is user friendly. So far I've developed two forms.
Form 1 shows an overview of orders. Form 2 shows the details of a specific order. Form 2 is build on a query that retrieves information from different tables.
When I open form 2, a parameter input dialog box appears asking me which ordernr he has to look for. When I type in a number, the specific details from that record are shown.
Now comes the tricky part. form 1 shows the overview. When i click on an ordernr a textbox is filled. I did this to confirm the program reads the right number.
My question: How do I get the number from my textfield in form 1, into the parameter input dialog in form 2? The numbers are stored as text so no conversion is needed.
I saw a lot of solutions with DoCmd.OpenForm "Formname" ,,,,,, OpenArgs. I do believe this can be the sollution. I just don't know how to get OpenArgs into the Parameter Input Dialog.
Thanks for helping!
Change the query of the second form to have the value of the text box that you populate as a filter on the ordernr field. You might also to set the 'Modal' property of the second form to 'True' as this will prevent (or hinder at least) unsynced forms.
Related
I have a report that changes based on the query used in the record source.
I did this to consolidate 6 different reports that printed the same formate and to the same label printer but they all used different data types/sources. I was able to convert all by 1.
The one I am having trouble with is one where there is a form, with a combobox and a textbox. The combobox has a table that its connected to with 11 different symbols ranging from Hearts to & and # stuff like that. The textbox will take any number/text combo.
When I run a query that I set up with [Forms]![frmPrintPtouchLabel]![txtName] and [Forms]![frmPrintPtouchLabel]![cmbSymbol].
The query pulls the right information except for the symbol that columb is left blank. Can anyone provide any reasoning as to why this is happening and how I can fix it?
Thank you.
Looks like there was fluke somewhere in my code or I was just over thinking something. After setting up a blank query I set a field: Symbol: [Forms]![frmPrintPtouchLabel]![cmbSymbol], and a field Name: [Forms]![frmPrintPtouchLabel]![txtName]
and I set up a button in a form that does DoCmd.OpenQuery "qry_TestQuery", in that same form there is the combobox with the Symbols, and a textbox for the Name, when I input those two and click the button the query opens with the proper information. Thanks for all that helped.
I'm trying to make a database for paperwork for a summer camp. Right now I have a form setup that has a combo box with the the children's name in the header. And I have three tabs separating the different papers they need to turn in (medical, permissions, etc). I have the combo box working, sort of. When I click on it I have it showing the list of names, but I don't seem to have it connected to the underlying table, so it could show the records. The records are all a mix of checkboxes (yes/no) and text boxes (for additional comments). Does the combo box need to have an After Update event, or would it be in another event? I've tried copying some code that I've found, but it hasn't seemed to work. Right now there should be some information that shows up that I've already entered directly into the table, but other fields I know are blank.
My goal is to be able to select a child from the combo box and pull up their records and edit information as needed. I'm a real beginner with coding, but I think it's something that would lead me to a solution here. I've been across a variety of forms today and nothing seems to have worked for me yet. I'm also just beginning to learn access so I'm only starting to know the kinds of questions to ask. Any help or suggestions would really be appreciated.
In an Access form, there are either bound or unbound controls. Bound means table fields are connected and unbound means there are no table field connection. The same can be said about bound and unbound forms where bound has a whole table connected to form and unbound does not. If you enter Design View, you will either see a field name in textbox or "Unbound" written in textbox. For checkboxes you cannot tell unless you enter its Property Sheet \ Data tab \ Control Source.
From your explanation, you seem to refer to a search box. This would be an unbound form as no data should be tied to it. Your header of Student's Name seems to be a bound textbox of student name. Search boxes have an AfterUpdate event built in either as a macro or VBA that searches a record that matches the selection of the drop down:
Macro:
Search Record
Object Type: Form
Object Name: YourFormName
Record: First
Where Condition: ="[ID] = " & Str(Nz([Screen].[ActiveControl],0))
VBA:
DoCmd.SearchForRecord acDataForm, "yourFormName", acFirst, "[ID] = " & Forms!YourFormNam!DropDownField
Please note you can create a search box simply by placing a new combo box on the form and following the Wizard all the way through. The outcome of this will be an AfterUpdate event macro as listed above. You must have canceled the wizard before finishing to have an unbound combo box with no functionality.
I have a form with 3 things for my users to fill in:
a textbox called ProjectName
two ActiveX control objects (Microsoft Time and Date picker Control 6.0) called ProjStartDate and ProjEndDate respectively
After my users have entered either of the above, they can click on a button that will call requery on a list box object in the form which will display the filtered results.
I have set the Row Source Type of the listbox to be "Table/Query" and its Row Source to be the below SQL query:
SELECT p.Title
FROM Project AS p
WHERE
p.Title = [Forms]![Search by project]![ProjectName]
OR (p.StartDate <= [Forms]![Search by project]![ProjStartDate]
AND p.EndDate >= [Forms]![Search by project]![ProjEndDate])
ORDER BY
p.ProjectId DESC;
However, every time I enter the form, it will prompt me with a pop up box asking me for a parameter called Forms!Search by project!ProjectName , Forms!Search by project!ProjStartDate and Forms!Search by project!ProjEndDate . If I enter the parameter for, lets say project name correctly, the list box will display the correct filter results.
Furthermore, even if I enter the correct keyword in the ProjectName textbox and requery, the parameter pop up box will still occur. Do anyone knows how to solve this issue? Thanks a lot in advance!
I first wrote this answer based on the assumption that all the controls were contained in a single form. However, if the list box is on a child form, the parent form's controls (such as [Forms]![Search by project]![ProjectName]) are not yet available when the child form first opens. If that is the case, you could leave the list box row source property empty, and wait until the parent form's Form Load event to assign your SELECT statement to the list box row source. Or leave the list box row source empty until the user clicks the command button.
The rest of this answer was about diagnosing a naming problem. Since you indicated in a comment that the query can work when run at certain times, I don't think naming is involved after all, but will leave it in case it may help someone else.
Open the Immediate window (Ctrl+g) and investigate why the db engine can't find those parameters.
With your "Search by project" form open in Form View, check its .Name property simply to verify Access sees the name you expect. If both you and Access agree on the form's name, you will get this ...
? Forms![Search by project].Name
Search by project
OTOH, if Access thinks the form has a different name, that attempt will trigger an error. If that happens, check the form name as Access sees it. This will give you the names of all open forms:
for each f in Forms : ? f.Name : next
Finally, examine the values of those form controls. Assuming "Search by project" is indeed the correct form name ...
? Forms![Search by project]!ProjectName
? Forms![Search by project]!ProjStartDate
? Forms![Search by project]!ProjEndDate
I have searched everywhere for this and tried different criteria but for whatever reason the form which has a control box set to open a report which is based upon a query will not pull the data within the date range. Instead keep getting enter parameter value dialogue box.
The criteria in the query is stated as Between [Forms]![Form1].[StartDt] And [Forms]![Form1].[EndDt]
The form has two date inputs StartDt and EndDt and is pointed to open the report. Without the above criteria in the query the form opens the report and produces all the dates. So at least it allows me to enter dates and is connected to the query and report but without the criteria fails to isolate data within the required range.
When I place into the query containing the criteria (as above) under the appointment date field all im getting are two parameter value dialogue boxes one after the other displaying Forms!Form1.StartDt and the second, Forms!Form1.EndDt.
Apologies for being long winded but am desperate to solve this issue am new to access.
Thanks to everyone for any input.
Iain
It seems you have an error in your names. One of the easiest ways to check form names is to use the immediate window. Type ctrl+G and you will end up in the code window with the cursor in the Immediate window. With the form open and a date filled in, type or paste
?forms!form1!StartDt
Into the immediate window and hit return. If you get an error, it means that you have a name wrong somewhere along the line, either your form is not called Form1, and form names can be a little complicated, or your control is not called StartDt. So this is where the version of Access comes in. In Access 2010, if you type Forms! on the criteria line of a query and wait a second, it will give you a list of forms. Pick your form from the list and type ! after the name, Access will come back with a list of controls. Pick your control. You should now have the right form and control name.
I have been battling with this problem for weeks now and simply cannot find a solution.
I am using MS Access 2007
I have a table caled "Policy Information" where all of my data is stored. I have created a combox box to autofill a few text fields using a query called "BC Allocation Query". By choosing from the combox269 field I created then 6 other text fields are automatically completed. I used the function =[Combo269].column in the control field of the text field I want auto-completed.
This all works great however I cannot seem to relfect the information from the text boxes which are auto-completed to relfect in my Access Reports whcih I have set up.
Please can someone assist me withthis before I jump off a cliff:)
Are these text fields on the form bound to fields in the source for the form? If not, they are unbound, and you need to write code to save this information into the table when you navigate away from the record or close the form. If they are bound, you need to programmatically force a save of the record when VBA changes values, otherwise - you might get the dreaded 'values changed by another user' verbage in an error.