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 |
#21
|
|||
|
|||
Required entry
Matt, sorry if I seem condescending, but you've been doing a terrible job of
describing how your application works. Most of your posts implied that you were forcing the agents to pick their name from a combo box that contained the names of the agents, and that each agent was only allowed to pick his/her own name. If that's the case, you shouldn't be using a combo box at all: you should have the query return details only for the current user. If your form has a control named cboAgent on it, you'd put in code: If IsNull(Me.cboAgent) Then MsgBox "You must pick an Agent." Else DoCmd.OpenReport... End If -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no e-mails, please!) "Matt Dawson" wrote in message ... Ok, now I think we have crossed wires. The report is launched from a swtichboard i have installed. The report has many agents in it though and it has to run even if one or two agents have forgotten. The report is only accesible by three users and there are a further 8 agents below that. Is there no definite formula which can just say, If Agent ID is Null, Then not allowed to leave form? "Douglas J. Steele" wrote: Since you're limiting what records are returned to the report, get AgentId from the recordsource, not from the combo box. How do you launch the report? Presumably you have a button that has DoCmd.OpenReport somewhere in its Click event. Simply put a check whether the value of the Combo Box is Null, and don't launch the report if it is. -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no e-mails, please!) "Matt Dawson" wrote in message ... I am referring to the combo box as Agent ID in the report. When i update from the combo box it works, yet if I have a list box and the name still appears, it does not appear in the report unless the name is highlighted by the user. Is there anyway of getting an error message to appear, as this way does not seem to work at all. Matt "Douglas J. Steele" wrote: That doesn't really tell me anything. Are you referring to the control on the form, or to a field in the recordsource? You should be referring to the field in the recordsource. -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no e-mails, please!) "Matt Dawson" wrote in message ... I am referring to it is Agent ID but this works for when the agent has been selected from the one list combo box! Again confused! "Douglas J. Steele" wrote: And how are you referring to Agent_ID in the report? -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no e-mails, please!) "Matt Dawson" wrote in message ... Jeff, If i do this, it still gives me a blank in the report where Agent ID would go. The name appears but unless i highlight it i.e. click it, it still gives me a blank value. Hence I use a combo box to try to remind them not to leave it blank! I have this entered in the form onload : Me.Agent_ID = CurrentUser() Matt "Jeff Boyce" wrote: Matt Thank you! You've just made my point. YOU want the ID so you can see it in a report. The Agents could care less, so they're forgetting to do it. So why force them to? If your application already knows who is using the computer (and it MUST, since you said you use CurrentUser to limit the list to a single Agent), have your computer enter the Agent behind the scenes. No need to even show the field ... after all, the Agent already knows who's using the computer, too! Doug offered a mechanism for automatically entering the value ... does that work for you? -- Regards Jeff Boyce Microsoft Office/Access MVP http://mvp.support.microsoft.com/ Microsoft IT Academy Program Mentor http://microsoftitacademy.com/ Microsoft Registered Partner https://partner.microsoft.com/ "Matt Dawson" wrote in message ... Basically, agents are forgetting to select their Agent ID in the form and if i make it a list box, even if default value is currentuser, it says the name but does not bring it up in the report unless the box is clicked. All I want is the Agent ID field is automatically selected to the current user and the report updates with this or an error message occurs when the message is left blank! And at the moment, i keep getting blanks in this field where they are forgetting Matt |
#22
|
|||
|
|||
Required entry
Doug,
I apologise. I can tell as I am typing it that it is a crap explanation, it is just difficult to get my point across. You have got the jist of it yes, but unless I have the Agent ID selected in some way, it does not update to the reports for some reason beknown to me. Under what section would I enter this code? Matt "Douglas J. Steele" wrote: Matt, sorry if I seem condescending, but you've been doing a terrible job of describing how your application works. Most of your posts implied that you were forcing the agents to pick their name from a combo box that contained the names of the agents, and that each agent was only allowed to pick his/her own name. If that's the case, you shouldn't be using a combo box at all: you should have the query return details only for the current user. If your form has a control named cboAgent on it, you'd put in code: If IsNull(Me.cboAgent) Then MsgBox "You must pick an Agent." Else DoCmd.OpenReport... End If -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no e-mails, please!) "Matt Dawson" wrote in message ... Ok, now I think we have crossed wires. The report is launched from a swtichboard i have installed. The report has many agents in it though and it has to run even if one or two agents have forgotten. The report is only accesible by three users and there are a further 8 agents below that. Is there no definite formula which can just say, If Agent ID is Null, Then not allowed to leave form? "Douglas J. Steele" wrote: Since you're limiting what records are returned to the report, get AgentId from the recordsource, not from the combo box. How do you launch the report? Presumably you have a button that has DoCmd.OpenReport somewhere in its Click event. Simply put a check whether the value of the Combo Box is Null, and don't launch the report if it is. -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no e-mails, please!) "Matt Dawson" wrote in message ... I am referring to the combo box as Agent ID in the report. When i update from the combo box it works, yet if I have a list box and the name still appears, it does not appear in the report unless the name is highlighted by the user. Is there anyway of getting an error message to appear, as this way does not seem to work at all. Matt "Douglas J. Steele" wrote: That doesn't really tell me anything. Are you referring to the control on the form, or to a field in the recordsource? You should be referring to the field in the recordsource. -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no e-mails, please!) "Matt Dawson" wrote in message ... I am referring to it is Agent ID but this works for when the agent has been selected from the one list combo box! Again confused! "Douglas J. Steele" wrote: And how are you referring to Agent_ID in the report? -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no e-mails, please!) "Matt Dawson" wrote in message ... Jeff, If i do this, it still gives me a blank in the report where Agent ID would go. The name appears but unless i highlight it i.e. click it, it still gives me a blank value. Hence I use a combo box to try to remind them not to leave it blank! I have this entered in the form onload : Me.Agent_ID = CurrentUser() Matt "Jeff Boyce" wrote: Matt Thank you! You've just made my point. YOU want the ID so you can see it in a report. The Agents could care less, so they're forgetting to do it. So why force them to? If your application already knows who is using the computer (and it MUST, since you said you use CurrentUser to limit the list to a single Agent), have your computer enter the Agent behind the scenes. No need to even show the field ... after all, the Agent already knows who's using the computer, too! Doug offered a mechanism for automatically entering the value ... does that work for you? -- Regards Jeff Boyce Microsoft Office/Access MVP http://mvp.support.microsoft.com/ Microsoft IT Academy Program Mentor http://microsoftitacademy.com/ Microsoft Registered Partner https://partner.microsoft.com/ "Matt Dawson" wrote in message ... Basically, agents are forgetting to select their Agent ID in the form and if i make it a list box, even if default value is currentuser, it says the name but does not bring it up in the report unless the box is clicked. All I want is the Agent ID field is automatically selected to the current user and the report updates with this or an error message occurs when the message is left blank! And at the moment, i keep getting blanks in this field where they are forgetting Matt |
#23
|
|||
|
|||
Required entry
In one place, you mentioned that you're using CurrentUser(). Does this mean
you've applied Access User-Level Security? (CurrentUser only returns something useful if you have: otherwise, it returns Admin for each user) If you have applied Access ULS, you should be able to put CurrentUser() as the criteria for the Agent ID field in your query, and it will only return details for the current Agent. If you haven't applied Access ULS, and what you really want is the network ID, take a look at http://www.mvps.org/access/api/api0008.htm at "The Access Web". You would then specify fOSUserName() as the criteria in your query. -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no private e-mails, please) "Matt Dawson" wrote in message ... Doug, I apologise. I can tell as I am typing it that it is a crap explanation, it is just difficult to get my point across. You have got the jist of it yes, but unless I have the Agent ID selected in some way, it does not update to the reports for some reason beknown to me. Under what section would I enter this code? Matt "Douglas J. Steele" wrote: Matt, sorry if I seem condescending, but you've been doing a terrible job of describing how your application works. Most of your posts implied that you were forcing the agents to pick their name from a combo box that contained the names of the agents, and that each agent was only allowed to pick his/her own name. If that's the case, you shouldn't be using a combo box at all: you should have the query return details only for the current user. If your form has a control named cboAgent on it, you'd put in code: If IsNull(Me.cboAgent) Then MsgBox "You must pick an Agent." Else DoCmd.OpenReport... End If -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no e-mails, please!) "Matt Dawson" wrote in message ... Ok, now I think we have crossed wires. The report is launched from a swtichboard i have installed. The report has many agents in it though and it has to run even if one or two agents have forgotten. The report is only accesible by three users and there are a further 8 agents below that. Is there no definite formula which can just say, If Agent ID is Null, Then not allowed to leave form? "Douglas J. Steele" wrote: Since you're limiting what records are returned to the report, get AgentId from the recordsource, not from the combo box. How do you launch the report? Presumably you have a button that has DoCmd.OpenReport somewhere in its Click event. Simply put a check whether the value of the Combo Box is Null, and don't launch the report if it is. -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no e-mails, please!) "Matt Dawson" wrote in message ... I am referring to the combo box as Agent ID in the report. When i update from the combo box it works, yet if I have a list box and the name still appears, it does not appear in the report unless the name is highlighted by the user. Is there anyway of getting an error message to appear, as this way does not seem to work at all. Matt "Douglas J. Steele" wrote: That doesn't really tell me anything. Are you referring to the control on the form, or to a field in the recordsource? You should be referring to the field in the recordsource. -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no e-mails, please!) "Matt Dawson" wrote in message ... I am referring to it is Agent ID but this works for when the agent has been selected from the one list combo box! Again confused! "Douglas J. Steele" wrote: And how are you referring to Agent_ID in the report? -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no e-mails, please!) "Matt Dawson" wrote in message ... Jeff, If i do this, it still gives me a blank in the report where Agent ID would go. The name appears but unless i highlight it i.e. click it, it still gives me a blank value. Hence I use a combo box to try to remind them not to leave it blank! I have this entered in the form onload : Me.Agent_ID = CurrentUser() Matt "Jeff Boyce" wrote: Matt Thank you! You've just made my point. YOU want the ID so you can see it in a report. The Agents could care less, so they're forgetting to do it. So why force them to? If your application already knows who is using the computer (and it MUST, since you said you use CurrentUser to limit the list to a single Agent), have your computer enter the Agent behind the scenes. No need to even show the field ... after all, the Agent already knows who's using the computer, too! Doug offered a mechanism for automatically entering the value ... does that work for you? -- Regards Jeff Boyce Microsoft Office/Access MVP http://mvp.support.microsoft.com/ Microsoft IT Academy Program Mentor http://microsoftitacademy.com/ Microsoft Registered Partner https://partner.microsoft.com/ "Matt Dawson" wrote in message ... Basically, agents are forgetting to select their Agent ID in the form and if i make it a list box, even if default value is currentuser, it says the name but does not bring it up in the report unless the box is clicked. All I want is the Agent ID field is automatically selected to the current user and the report updates with this or an error message occurs when the message is left blank! And at the moment, i keep getting blanks in this field where they are forgetting Matt |
Thread Tools | |
Display Modes | |
|
|