If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Auto-fill query parameter from form
I have form this filled out with customer information. the primary key being
the customer number. once this form is filled out, I click a button that runs a macro to 1) query by customer number, at which point i have to enter the customer number into parameters 2) it opens that customer's information into a more presentable form to be printed 3) automatically prompts for printer of choice 4) after printer is chosen, the form closes and returns back to the other form for a new entry. Is there a way to fix step one to where I don't have to enter the employee number into the parameters? Can I get the macro to read the current form information and spit it out to either my more printable form (printing selected record) or into a printable report for just that form? |
#2
|
|||
|
|||
Auto-fill query parameter from form
If your macro is using the OpenReport Action, you can use the Where
paramenter to enter the reference to the form control that has the customer number. Remove the parameter from the query that is the report's record source. Here is how to set up the Where parameter: [FieldName] = Forms!FormName!ControlName [FieldName] is the name of the field in the report's record source query for the customer number FormName is the name of your form ControlName is the name of the control on the form that has the customer number. -- Dave Hargis, Microsoft Access MVP "Mac" wrote: I have form this filled out with customer information. the primary key being the customer number. once this form is filled out, I click a button that runs a macro to 1) query by customer number, at which point i have to enter the customer number into parameters 2) it opens that customer's information into a more presentable form to be printed 3) automatically prompts for printer of choice 4) after printer is chosen, the form closes and returns back to the other form for a new entry. Is there a way to fix step one to where I don't have to enter the employee number into the parameters? Can I get the macro to read the current form information and spit it out to either my more printable form (printing selected record) or into a printable report for just that form? |
#3
|
|||
|
|||
Auto-fill query parameter from form
I typed in
[Account] = Forms!New Customer Form!Account Are the field name and controlName the same source? "Klatuu" wrote: If your macro is using the OpenReport Action, you can use the Where paramenter to enter the reference to the form control that has the customer number. Remove the parameter from the query that is the report's record source. Here is how to set up the Where parameter: [FieldName] = Forms!FormName!ControlName [FieldName] is the name of the field in the report's record source query for the customer number FormName is the name of your form ControlName is the name of the control on the form that has the customer number. -- Dave Hargis, Microsoft Access MVP "Mac" wrote: I have form this filled out with customer information. the primary key being the customer number. once this form is filled out, I click a button that runs a macro to 1) query by customer number, at which point i have to enter the customer number into parameters 2) it opens that customer's information into a more presentable form to be printed 3) automatically prompts for printer of choice 4) after printer is chosen, the form closes and returns back to the other form for a new entry. Is there a way to fix step one to where I don't have to enter the employee number into the parameters? Can I get the macro to read the current form information and spit it out to either my more printable form (printing selected record) or into a printable report for just that form? |
#4
|
|||
|
|||
Auto-fill query parameter from form
No. [Account] should be the name of the field in the report's record source
query and !Account should be the name of the control on the form. The value in the !Account control should contain the value you want to find in the field [Account]. There is also a syntax error. Names of objects really shouldn't have spaces in them, but when you do, you need to surround them with brackets so Access knows what it is. Try: [Account] = [Forms]![New Customer Form]![Account] -- Dave Hargis, Microsoft Access MVP "Mac" wrote: I typed in [Account] = Forms!New Customer Form!Account Are the field name and controlName the same source? "Klatuu" wrote: If your macro is using the OpenReport Action, you can use the Where paramenter to enter the reference to the form control that has the customer number. Remove the parameter from the query that is the report's record source. Here is how to set up the Where parameter: [FieldName] = Forms!FormName!ControlName [FieldName] is the name of the field in the report's record source query for the customer number FormName is the name of your form ControlName is the name of the control on the form that has the customer number. -- Dave Hargis, Microsoft Access MVP "Mac" wrote: I have form this filled out with customer information. the primary key being the customer number. once this form is filled out, I click a button that runs a macro to 1) query by customer number, at which point i have to enter the customer number into parameters 2) it opens that customer's information into a more presentable form to be printed 3) automatically prompts for printer of choice 4) after printer is chosen, the form closes and returns back to the other form for a new entry. Is there a way to fix step one to where I don't have to enter the employee number into the parameters? Can I get the macro to read the current form information and spit it out to either my more printable form (printing selected record) or into a printable report for just that form? |
Thread Tools | |
Display Modes | |
|
|