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 |
#11
|
|||
|
|||
Records not adding...Please help!
Bruce, thanks for your advise! The scope of the project changesd direction a
bit. I have another questions, maybe you can help me. I am trying to create this IIF statement in a control and something is off, can you take a look at it? = IIf( [2oz] ="X" and [Date] 0#5/14/2007#,.545,IIf( [2oz] = is Null and [Date] #5/14/2007#,.321,IIf( [2oz] = "x" and [Date] =#05/14/2007#,.459,IIf( [2oz] = is Null and [Date] = #05/14/2007#,.334)))) THANK YOU! "BruceM" wrote: Responses inline. "Yula" wrote in message ... Bruce thank you for all your advise so far, but here is the problem. I have been working on this project for a while and I really need to come up with a form for people to fill out that will store the info that they fill in. I don't have the luxury any more to learn more termanology, I have to show something for all the time I out in. I leaned access from scratch and the posts that i found here... and I am sure I know maybe 3% of what's there, but that's not excuse for not getting this project done. A great deal can be accomplished with just a fraction of the capabilities of Access, but a solid design is essential to using Access properly. Without knowing more about how your database is structured or the real-world situation it is trying to addess I may not be able to offer many useful suggestions. Much can be accomplished with Access, but there is a substantial learning curve. You may not have enough knowledge of the product to get the particular job done. By analogy, having a learner's permit, and being familiar with the basics of putting a car into gear and steering it around the neighborhood, does not qualify you to take part in a road rally. It's not an excuse, it's a fact. To answer your questions: I ran the compile in VBA and there was one problem, I took care of it. When I say Control source = master Item #=forms!FrmJob1ID.Column(7), I mean by that the control source in the properties sheet for that text box is called master item #. For what text box? What is Forms!frmJob1ID.Column(7)? Also, I don't think I would need a "contact" table to be updated b/c the user is selecting from a given list of operators. When they select the operator from the combo box, other text boxes are automatically populated. The Contacts table was an example: "If you have a Contacts table ...". It is a familiar situation, so I had hoped it would be useful as an example. Ex. Combo box Operator. Row souce in properties is called operator query Column 1 shows: Bob, John, Joe, Mike What is the source for the operator query? Is there an Employee table or something of the sort? Machine they work on text box: autopopulates 12345 (based on Operator query column 2) Each operator works on just one machine? Do you mean they operate the machine, or is this a shop that repairs machines? "Work on" is a vague term. In any case, "machine they work on" is not an attribute of an operator, so the information should be stored in a separate table. If that is already the case, and the operator query assembles information from several tables, the question remains whether you need to store the information about machine and shift, or just link to it. Shift they work, text box autopopulates 1 (based on operator query column 3) That's pretty much the set up for this form. When the user selects something from the combo box(based on row sources and the text boxes based on control sources), other text boxes autopopulate. I hope this makes sense. I'm sorry to have to tell you it does not make much sense to me. I am unfamiliar either with the real-world business situation you are trying to address or the structure of your database. If you can post a description of the tables and relationships it may be possible to come up with something more definite. "BruceM" wrote: With the VBA editor open, click Debug Compile ___ to compile the code. If you have created a situation such as attempting to requery a field (rather than a control), it will highlight the line of code. It also guards against typographical errors, and quite a few other things that will prevent the code from running. I am not quite sure what to make of something like: control source = Master Item2 = Forms!FrmJob1!ID.Column(7) Is MasterItem2 a combo box? If so, Forms!FrmJob1!ID.Column(7) cannot be its control source. The Control Source is the field to which a control is bound. If you have a Contacts table with fields for FirstName, LastName, etc., and you create a form bound to the Contacts table for entering and editing contact information, then information typed into a text box with its control source set to FirstName will store that information in the FirstName field of the Contacts table. To elaborate a bit, open a form in design view. Click View Properties (or double click the small square at the very top left of the form window). You will see a place for the Record Source. If you select a table or a query bound to the table as the Record Source, the form is a bound form. That is, it is bound to that record source (table or query). The form becomes a sort of portal to the table. Next, the controls. A control is a combo box, text box, label, line, or just about anything else on the form. Some controls, such as text boxes and combo boxes, may be bound to fields in the form's Record Source. That is, a field from the form's Record Source is selected as the control's Control Source. Information entered into the bound control (or selected from a combo box list, which accomplishes the same thing as typing into a text box) will be stored in that field in the form's Record Source. Back to the code you have provided, this cannot do anything I can see: Control Source=PS Item 2= " " (8) Another thing I found puzzling was that you said the info needs to be saved to a new table. Why? It is possible to create a table through code and store information there. I couldn't say exactly how to go about that, but I doubt very much that it is what you need to do. I think a greater understanding of some of the terminology would be of help. A good place to start is he http://allenbrowne.com/tips.html In particular, look at the Table Design links in the Tips for Casual Users. On the right side of the page, toward the bottom of the list, is a Links link. That will take you to quite an extensive list of Access links for users of all levels. "Yula" wrote in message ... Below are my combo boxes: Combo Category = Row Source = Select Query Combo Job = Row Source = Query 5 (Main Query) Cat ID, Cat code, Job Name, Master item, PS item, Master Desc, Price, Master item 2, ps item2, price2, mat2, job cc, contact Combo ID = row source = query 5, event procedure after update text box = count postage = row source = select query postage tab 2 - materials control source = Master Item = Forms!FrmJob1!ID.Column(3) Control Source=PS Item = " " (4) Control Source = Desc = " " (5) Control Source = Price = " " (6) control source = Master Item2 = Forms!FrmJob1!ID.Column(7) Control Source=PS Item 2= " " (8) Control Source = Desc 2= " " (10) Control Source = Price 2= " " (9) Summary Control Source Material A = forms!FrmJob1ID.Column(6)*Forms!frmjob1!count Control Source Material b = forms!FrmJob1ID.Column(9)*Forms!frmjob1!count Control Source OH = Forms!frmjob1!count*.1234 Control Source Postage = Forms!frmjob1!count*Forms!FrmJob1!Postage.column1( 1) I need the user to fill in the info and all the info needs to be saved to a new table. Bruce, I am not sure what you mean by compile the code? Do you mean run? everything works when I click out of design view. I just can't add any records or save it anywhere. "BruceM" wrote: Are the combo boxes and text boxes that are based on queries bound to fields in the form's record source query? Saving the record After Update will not do anything I can see, since updating means the record has been saved. You would be saving it after it has been saved. However, if you wish to force a save during record creation (for instance, if there is validation code in Before Update you may wish to force the Before Update event to run) you can just use Me.Dirty = False instead of that MenuItem stuff. Are you able to compile the code? "Yula" wrote in message ... I created a standard form and than I added a lot of combo boxes and text boxes that are based on queries. Also, below is the forms after update procedure. I have combo boxes based on one another. I think the problem is that the form needs some kind of a procedure to save to the recordsource table. I think there is a diconnect between the controls being selected on the form and the table where I want them to be saved. I am just not sure what to do about it. Should I create a procedure to save afterupdate to the table which is my recordsource Private Sub Category_AfterUpdate() Me.Job = Null Me.Job.Requery Me.Job = Me.Job.ItemData(0) End Sub Private Sub JES_AfterUpdate() Me.JES = Null Me.JES.Requery Me.JES = Me.JES.ItemData(0) End Sub Private Sub Form_Current() If Me.NewRecord Then Me!Inserter.SetFocus End If End Sub Private Sub ID_AfterUpdate() End Sub Private Sub ID_BeforeUpdate(Cancel As Integer) End Sub Private Sub Job_AfterUpdate() Me.ID = Null Me.ID.Requery Me.ID = Me.ID.ItemData(0) End Sub Private Sub Command230_Click() On Error GoTo Err_Command230_Click DoCmd.GoToRecord , , acNext Exit_Command230_Click: Exit Sub Err_Command230_Click: MsgBox Err.Description Resume Exit_Command230_Click End Sub Private Sub Command231_Click() On Error GoTo Err_Command231_Click DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70 Exit_Command231_Click: Exit Sub Err_Command231_Click: MsgBox Err.Description Resume Exit_Command231_Click End Sub "Maurice" wrote: |
#12
|
|||
|
|||
Records not adding...Please help!
It is ususally a good idea to state the nature of the problem. "Something
is off" is vague. I noticed a few things. There was an extra 0 before the first instance of the Date. Also, use Is Null, not = Is Null. Be aware that Date is a reserved word in Access, and should not be used for a field name. For a listing of reserved words, see: http://www.accessmvp.com/JConrad/acc...#ReservedWords In particular, look at Reserved Words in Microsoft Access and Reserved Words in Jet 4.0. You can get around using a reserved word by enclosing it in brackets, but sooner or later you will run into a problem with using reserved words incorrectly, and it could be difficult to track down. Having said that, here is your expression, amended. = IIf( [2oz] ="X" and [Date] #5/14/2007#,.545,IIf( [2oz] Is Null and [Date] #5/14/2007#,.321,IIf( [2oz] = "x" and [Date] = #05/14/2007#,.459,IIf( [2oz] Is Null and [Date] = #05/14/2007#,.334)))) You can, however, shorten it to something like: = IIf([2oz] = "X",IIf([Date] #5/14/07#,.545,.459),IIf([2oz] Is Null,IIf([Date] #5/14/07#,.321,.334))) There are only two choices for the date: before 5/14/07, or else on or after 5/14/07. You don't need to test for =, because anything that is not is automatically =. If the only two choices are X or null, you can shorten it to: = IIf([2oz] = "X",IIf([Date] #5/14/07#,.545,.459),IIf([Date] #5/14/07#,.321,.334)) However, if there could be an entry other than X or Null you will need to allow for that in the expression: = IIf([2oz] = "X",IIf([Date] #5/14/07#,.545,.459),IIf([2oz] Is Null,IIf([Date] #5/14/07#,.321,.334),"Other")) If the expression gets much more involved than that you may do well to use VBA, where a wider range of approaches are possible. "Yula" wrote in message ... Bruce, thanks for your advise! The scope of the project changesd direction a bit. I have another questions, maybe you can help me. I am trying to create this IIF statement in a control and something is off, can you take a look at it? = IIf( [2oz] ="X" and [Date] 0#5/14/2007#,.545,IIf( [2oz] = is Null and [Date] #5/14/2007#,.321,IIf( [2oz] = "x" and [Date] =#05/14/2007#,.459,IIf( [2oz] = is Null and [Date] = #05/14/2007#,.334)))) THANK YOU! "BruceM" wrote: Responses inline. "Yula" wrote in message ... Bruce thank you for all your advise so far, but here is the problem. I have been working on this project for a while and I really need to come up with a form for people to fill out that will store the info that they fill in. I don't have the luxury any more to learn more termanology, I have to show something for all the time I out in. I leaned access from scratch and the posts that i found here... and I am sure I know maybe 3% of what's there, but that's not excuse for not getting this project done. A great deal can be accomplished with just a fraction of the capabilities of Access, but a solid design is essential to using Access properly. Without knowing more about how your database is structured or the real-world situation it is trying to addess I may not be able to offer many useful suggestions. Much can be accomplished with Access, but there is a substantial learning curve. You may not have enough knowledge of the product to get the particular job done. By analogy, having a learner's permit, and being familiar with the basics of putting a car into gear and steering it around the neighborhood, does not qualify you to take part in a road rally. It's not an excuse, it's a fact. To answer your questions: I ran the compile in VBA and there was one problem, I took care of it. When I say Control source = master Item #=forms!FrmJob1ID.Column(7), I mean by that the control source in the properties sheet for that text box is called master item #. For what text box? What is Forms!frmJob1ID.Column(7)? Also, I don't think I would need a "contact" table to be updated b/c the user is selecting from a given list of operators. When they select the operator from the combo box, other text boxes are automatically populated. The Contacts table was an example: "If you have a Contacts table ...". It is a familiar situation, so I had hoped it would be useful as an example. Ex. Combo box Operator. Row souce in properties is called operator query Column 1 shows: Bob, John, Joe, Mike What is the source for the operator query? Is there an Employee table or something of the sort? Machine they work on text box: autopopulates 12345 (based on Operator query column 2) Each operator works on just one machine? Do you mean they operate the machine, or is this a shop that repairs machines? "Work on" is a vague term. In any case, "machine they work on" is not an attribute of an operator, so the information should be stored in a separate table. If that is already the case, and the operator query assembles information from several tables, the question remains whether you need to store the information about machine and shift, or just link to it. Shift they work, text box autopopulates 1 (based on operator query column 3) That's pretty much the set up for this form. When the user selects something from the combo box(based on row sources and the text boxes based on control sources), other text boxes autopopulate. I hope this makes sense. I'm sorry to have to tell you it does not make much sense to me. I am unfamiliar either with the real-world business situation you are trying to address or the structure of your database. If you can post a description of the tables and relationships it may be possible to come up with something more definite. "BruceM" wrote: With the VBA editor open, click Debug Compile ___ to compile the code. If you have created a situation such as attempting to requery a field (rather than a control), it will highlight the line of code. It also guards against typographical errors, and quite a few other things that will prevent the code from running. I am not quite sure what to make of something like: control source = Master Item2 = Forms!FrmJob1!ID.Column(7) Is MasterItem2 a combo box? If so, Forms!FrmJob1!ID.Column(7) cannot be its control source. The Control Source is the field to which a control is bound. If you have a Contacts table with fields for FirstName, LastName, etc., and you create a form bound to the Contacts table for entering and editing contact information, then information typed into a text box with its control source set to FirstName will store that information in the FirstName field of the Contacts table. To elaborate a bit, open a form in design view. Click View Properties (or double click the small square at the very top left of the form window). You will see a place for the Record Source. If you select a table or a query bound to the table as the Record Source, the form is a bound form. That is, it is bound to that record source (table or query). The form becomes a sort of portal to the table. Next, the controls. A control is a combo box, text box, label, line, or just about anything else on the form. Some controls, such as text boxes and combo boxes, may be bound to fields in the form's Record Source. That is, a field from the form's Record Source is selected as the control's Control Source. Information entered into the bound control (or selected from a combo box list, which accomplishes the same thing as typing into a text box) will be stored in that field in the form's Record Source. Back to the code you have provided, this cannot do anything I can see: Control Source=PS Item 2= " " (8) Another thing I found puzzling was that you said the info needs to be saved to a new table. Why? It is possible to create a table through code and store information there. I couldn't say exactly how to go about that, but I doubt very much that it is what you need to do. I think a greater understanding of some of the terminology would be of help. A good place to start is he http://allenbrowne.com/tips.html In particular, look at the Table Design links in the Tips for Casual Users. On the right side of the page, toward the bottom of the list, is a Links link. That will take you to quite an extensive list of Access links for users of all levels. "Yula" wrote in message ... Below are my combo boxes: Combo Category = Row Source = Select Query Combo Job = Row Source = Query 5 (Main Query) Cat ID, Cat code, Job Name, Master item, PS item, Master Desc, Price, Master item 2, ps item2, price2, mat2, job cc, contact Combo ID = row source = query 5, event procedure after update text box = count postage = row source = select query postage tab 2 - materials control source = Master Item = Forms!FrmJob1!ID.Column(3) Control Source=PS Item = " " (4) Control Source = Desc = " " (5) Control Source = Price = " " (6) control source = Master Item2 = Forms!FrmJob1!ID.Column(7) Control Source=PS Item 2= " " (8) Control Source = Desc 2= " " (10) Control Source = Price 2= " " (9) Summary Control Source Material A = forms!FrmJob1ID.Column(6)*Forms!frmjob1!count Control Source Material b = forms!FrmJob1ID.Column(9)*Forms!frmjob1!count Control Source OH = Forms!frmjob1!count*.1234 Control Source Postage = Forms!frmjob1!count*Forms!FrmJob1!Postage.column1( 1) I need the user to fill in the info and all the info needs to be saved to a new table. Bruce, I am not sure what you mean by compile the code? Do you mean run? everything works when I click out of design view. I just can't add any records or save it anywhere. "BruceM" wrote: Are the combo boxes and text boxes that are based on queries bound to fields in the form's record source query? Saving the record After Update will not do anything I can see, since updating means the record has been saved. You would be saving it after it has been saved. However, if you wish to force a save during record creation (for instance, if there is validation code in Before Update you may wish to force the Before Update event to run) you can just use Me.Dirty = False instead of that MenuItem stuff. Are you able to compile the code? "Yula" wrote in message ... I created a standard form and than I added a lot of combo boxes and text boxes that are based on queries. Also, below is the forms after update procedure. I have combo boxes based on one another. I think the problem is that the form needs some kind of a procedure to save to the recordsource table. I think there is a diconnect between the controls being selected on the form and the table where I want them to be saved. I am just not sure what to do about it. Should I create a procedure to save afterupdate to the table which is my recordsource Private Sub Category_AfterUpdate() Me.Job = Null Me.Job.Requery Me.Job = Me.Job.ItemData(0) End Sub Private Sub JES_AfterUpdate() Me.JES = Null Me.JES.Requery Me.JES = Me.JES.ItemData(0) End Sub Private Sub Form_Current() If Me.NewRecord Then Me!Inserter.SetFocus End If End Sub Private Sub ID_AfterUpdate() End Sub Private Sub ID_BeforeUpdate(Cancel As Integer) End Sub Private Sub Job_AfterUpdate() Me.ID = Null Me.ID.Requery Me.ID = Me.ID.ItemData(0) End Sub Private Sub Command230_Click() On Error GoTo Err_Command230_Click DoCmd.GoToRecord , , acNext Exit_Command230_Click: Exit Sub Err_Command230_Click: MsgBox Err.Description Resume Exit_Command230_Click End Sub Private Sub Command231_Click() On Error GoTo Err_Command231_Click DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70 Exit_Command231_Click: Exit Sub Err_Command231_Click: MsgBox Err.Description Resume Exit_Command231_Click End Sub "Maurice" wrote: |
#13
|
|||
|
|||
Records not adding...Please help!
Bruce, Thank you very much, this was very helpful!!!
"BruceM" wrote: It is ususally a good idea to state the nature of the problem. "Something is off" is vague. I noticed a few things. There was an extra 0 before the first instance of the Date. Also, use Is Null, not = Is Null. Be aware that Date is a reserved word in Access, and should not be used for a field name. For a listing of reserved words, see: http://www.accessmvp.com/JConrad/acc...#ReservedWords In particular, look at Reserved Words in Microsoft Access and Reserved Words in Jet 4.0. You can get around using a reserved word by enclosing it in brackets, but sooner or later you will run into a problem with using reserved words incorrectly, and it could be difficult to track down. Having said that, here is your expression, amended. = IIf( [2oz] ="X" and [Date] #5/14/2007#,.545,IIf( [2oz] Is Null and [Date] #5/14/2007#,.321,IIf( [2oz] = "x" and [Date] = #05/14/2007#,.459,IIf( [2oz] Is Null and [Date] = #05/14/2007#,.334)))) You can, however, shorten it to something like: = IIf([2oz] = "X",IIf([Date] #5/14/07#,.545,.459),IIf([2oz] Is Null,IIf([Date] #5/14/07#,.321,.334))) There are only two choices for the date: before 5/14/07, or else on or after 5/14/07. You don't need to test for =, because anything that is not is automatically =. If the only two choices are X or null, you can shorten it to: = IIf([2oz] = "X",IIf([Date] #5/14/07#,.545,.459),IIf([Date] #5/14/07#,.321,.334)) However, if there could be an entry other than X or Null you will need to allow for that in the expression: = IIf([2oz] = "X",IIf([Date] #5/14/07#,.545,.459),IIf([2oz] Is Null,IIf([Date] #5/14/07#,.321,.334),"Other")) If the expression gets much more involved than that you may do well to use VBA, where a wider range of approaches are possible. "Yula" wrote in message ... Bruce, thanks for your advise! The scope of the project changesd direction a bit. I have another questions, maybe you can help me. I am trying to create this IIF statement in a control and something is off, can you take a look at it? = IIf( [2oz] ="X" and [Date] 0#5/14/2007#,.545,IIf( [2oz] = is Null and [Date] #5/14/2007#,.321,IIf( [2oz] = "x" and [Date] =#05/14/2007#,.459,IIf( [2oz] = is Null and [Date] = #05/14/2007#,.334)))) THANK YOU! "BruceM" wrote: Responses inline. "Yula" wrote in message ... Bruce thank you for all your advise so far, but here is the problem. I have been working on this project for a while and I really need to come up with a form for people to fill out that will store the info that they fill in. I don't have the luxury any more to learn more termanology, I have to show something for all the time I out in. I leaned access from scratch and the posts that i found here... and I am sure I know maybe 3% of what's there, but that's not excuse for not getting this project done. A great deal can be accomplished with just a fraction of the capabilities of Access, but a solid design is essential to using Access properly. Without knowing more about how your database is structured or the real-world situation it is trying to addess I may not be able to offer many useful suggestions. Much can be accomplished with Access, but there is a substantial learning curve. You may not have enough knowledge of the product to get the particular job done. By analogy, having a learner's permit, and being familiar with the basics of putting a car into gear and steering it around the neighborhood, does not qualify you to take part in a road rally. It's not an excuse, it's a fact. To answer your questions: I ran the compile in VBA and there was one problem, I took care of it. When I say Control source = master Item #=forms!FrmJob1ID.Column(7), I mean by that the control source in the properties sheet for that text box is called master item #. For what text box? What is Forms!frmJob1ID.Column(7)? Also, I don't think I would need a "contact" table to be updated b/c the user is selecting from a given list of operators. When they select the operator from the combo box, other text boxes are automatically populated. The Contacts table was an example: "If you have a Contacts table ...". It is a familiar situation, so I had hoped it would be useful as an example. Ex. Combo box Operator. Row souce in properties is called operator query Column 1 shows: Bob, John, Joe, Mike What is the source for the operator query? Is there an Employee table or something of the sort? Machine they work on text box: autopopulates 12345 (based on Operator query column 2) Each operator works on just one machine? Do you mean they operate the machine, or is this a shop that repairs machines? "Work on" is a vague term. In any case, "machine they work on" is not an attribute of an operator, so the information should be stored in a separate table. If that is already the case, and the operator query assembles information from several tables, the question remains whether you need to store the information about machine and shift, or just link to it. Shift they work, text box autopopulates 1 (based on operator query column 3) That's pretty much the set up for this form. When the user selects something from the combo box(based on row sources and the text boxes based on control sources), other text boxes autopopulate. I hope this makes sense. I'm sorry to have to tell you it does not make much sense to me. I am unfamiliar either with the real-world business situation you are trying to address or the structure of your database. If you can post a description of the tables and relationships it may be possible to come up with something more definite. "BruceM" wrote: With the VBA editor open, click Debug Compile ___ to compile the code. If you have created a situation such as attempting to requery a field (rather than a control), it will highlight the line of code. It also guards against typographical errors, and quite a few other things that will prevent the code from running. I am not quite sure what to make of something like: control source = Master Item2 = Forms!FrmJob1!ID.Column(7) Is MasterItem2 a combo box? If so, Forms!FrmJob1!ID.Column(7) cannot be its control source. The Control Source is the field to which a control is bound. If you have a Contacts table with fields for FirstName, LastName, etc., and you create a form bound to the Contacts table for entering and editing contact information, then information typed into a text box with its control source set to FirstName will store that information in the FirstName field of the Contacts table. To elaborate a bit, open a form in design view. Click View Properties (or double click the small square at the very top left of the form window). You will see a place for the Record Source. If you select a table or a query bound to the table as the Record Source, the form is a bound form. That is, it is bound to that record source (table or query). The form becomes a sort of portal to the table. Next, the controls. A control is a combo box, text box, label, line, or just about anything else on the form. Some controls, such as text boxes and combo boxes, may be bound to fields in the form's Record Source. That is, a field from the form's Record Source is selected as the control's Control Source. Information entered into the bound control (or selected from a combo box list, which accomplishes the same thing as typing into a text box) will be stored in that field in the form's Record Source. Back to the code you have provided, this cannot do anything I can see: Control Source=PS Item 2= " " (8) Another thing I found puzzling was that you said the info needs to be saved to a new table. Why? It is possible to create a table through code and store information there. I couldn't say exactly how to go about that, but I doubt very much that it is what you need to do. I think a greater understanding of some of the terminology would be of help. A good place to start is he http://allenbrowne.com/tips.html In particular, look at the Table Design links in the Tips for Casual Users. On the right side of the page, toward the bottom of the list, is a Links link. That will take you to quite an extensive list of Access links for users of all levels. "Yula" wrote in message ... Below are my combo boxes: Combo Category = Row Source = Select Query Combo Job = Row Source = Query 5 (Main Query) Cat ID, Cat code, Job Name, Master item, PS item, Master Desc, Price, Master item 2, ps item2, price2, mat2, job cc, contact Combo ID = row source = query 5, event procedure after update text box = count postage = row source = select query postage tab 2 - materials control source = Master Item = Forms!FrmJob1!ID.Column(3) Control Source=PS Item = " " (4) Control Source = Desc = " " (5) Control Source = Price = " " (6) control source = Master Item2 = Forms!FrmJob1!ID.Column(7) Control Source=PS Item 2= " " (8) Control Source = Desc 2= " " (10) Control Source = Price 2= " " (9) Summary Control Source Material A = forms!FrmJob1ID.Column(6)*Forms!frmjob1!count Control Source Material b = forms!FrmJob1ID.Column(9)*Forms!frmjob1!count Control Source OH = Forms!frmjob1!count*.1234 Control Source Postage = Forms!frmjob1!count*Forms!FrmJob1!Postage.column1( 1) I need the user to fill in the info and all the info needs to be saved to a new table. Bruce, I am not sure what you mean by compile the code? Do you mean run? everything works when I click out of design view. I just can't add any records or save it anywhere. "BruceM" wrote: Are the combo boxes and text boxes that are based on queries bound to fields in the form's record source query? Saving the record After Update will not do anything I can see, since updating means the record has been saved. You would be saving it after it has been saved. However, if you wish to force a save during record creation (for instance, if there is validation code in Before Update you may wish to force the Before Update event to run) you can just use Me.Dirty = |
#14
|
|||
|
|||
Records not adding...Please help!
Glad to help. Good luck with the project.
"Yula" wrote in message ... Bruce, Thank you very much, this was very helpful!!! "BruceM" wrote: It is ususally a good idea to state the nature of the problem. "Something is off" is vague. I noticed a few things. There was an extra 0 before the first instance of the Date. Also, use Is Null, not = Is Null. Be aware that Date is a reserved word in Access, and should not be used for a field name. For a listing of reserved words, see: http://www.accessmvp.com/JConrad/acc...#ReservedWords In particular, look at Reserved Words in Microsoft Access and Reserved Words in Jet 4.0. You can get around using a reserved word by enclosing it in brackets, but sooner or later you will run into a problem with using reserved words incorrectly, and it could be difficult to track down. Having said that, here is your expression, amended. = IIf( [2oz] ="X" and [Date] #5/14/2007#,.545,IIf( [2oz] Is Null and [Date] #5/14/2007#,.321,IIf( [2oz] = "x" and [Date] = #05/14/2007#,.459,IIf( [2oz] Is Null and [Date] = #05/14/2007#,.334)))) You can, however, shorten it to something like: = IIf([2oz] = "X",IIf([Date] #5/14/07#,.545,.459),IIf([2oz] Is Null,IIf([Date] #5/14/07#,.321,.334))) There are only two choices for the date: before 5/14/07, or else on or after 5/14/07. You don't need to test for =, because anything that is not is automatically =. If the only two choices are X or null, you can shorten it to: = IIf([2oz] = "X",IIf([Date] #5/14/07#,.545,.459),IIf([Date] #5/14/07#,.321,.334)) However, if there could be an entry other than X or Null you will need to allow for that in the expression: = IIf([2oz] = "X",IIf([Date] #5/14/07#,.545,.459),IIf([2oz] Is Null,IIf([Date] #5/14/07#,.321,.334),"Other")) If the expression gets much more involved than that you may do well to use VBA, where a wider range of approaches are possible. "Yula" wrote in message ... Bruce, thanks for your advise! The scope of the project changesd direction a bit. I have another questions, maybe you can help me. I am trying to create this IIF statement in a control and something is off, can you take a look at it? = IIf( [2oz] ="X" and [Date] 0#5/14/2007#,.545,IIf( [2oz] = is Null and [Date] #5/14/2007#,.321,IIf( [2oz] = "x" and [Date] =#05/14/2007#,.459,IIf( [2oz] = is Null and [Date] = #05/14/2007#,.334)))) THANK YOU! "BruceM" wrote: Responses inline. "Yula" wrote in message ... Bruce thank you for all your advise so far, but here is the problem. I have been working on this project for a while and I really need to come up with a form for people to fill out that will store the info that they fill in. I don't have the luxury any more to learn more termanology, I have to show something for all the time I out in. I leaned access from scratch and the posts that i found here... and I am sure I know maybe 3% of what's there, but that's not excuse for not getting this project done. A great deal can be accomplished with just a fraction of the capabilities of Access, but a solid design is essential to using Access properly. Without knowing more about how your database is structured or the real-world situation it is trying to addess I may not be able to offer many useful suggestions. Much can be accomplished with Access, but there is a substantial learning curve. You may not have enough knowledge of the product to get the particular job done. By analogy, having a learner's permit, and being familiar with the basics of putting a car into gear and steering it around the neighborhood, does not qualify you to take part in a road rally. It's not an excuse, it's a fact. To answer your questions: I ran the compile in VBA and there was one problem, I took care of it. When I say Control source = master Item #=forms!FrmJob1ID.Column(7), I mean by that the control source in the properties sheet for that text box is called master item #. For what text box? What is Forms!frmJob1ID.Column(7)? Also, I don't think I would need a "contact" table to be updated b/c the user is selecting from a given list of operators. When they select the operator from the combo box, other text boxes are automatically populated. The Contacts table was an example: "If you have a Contacts table ...". It is a familiar situation, so I had hoped it would be useful as an example. Ex. Combo box Operator. Row souce in properties is called operator query Column 1 shows: Bob, John, Joe, Mike What is the source for the operator query? Is there an Employee table or something of the sort? Machine they work on text box: autopopulates 12345 (based on Operator query column 2) Each operator works on just one machine? Do you mean they operate the machine, or is this a shop that repairs machines? "Work on" is a vague term. In any case, "machine they work on" is not an attribute of an operator, so the information should be stored in a separate table. If that is already the case, and the operator query assembles information from several tables, the question remains whether you need to store the information about machine and shift, or just link to it. Shift they work, text box autopopulates 1 (based on operator query column 3) That's pretty much the set up for this form. When the user selects something from the combo box(based on row sources and the text boxes based on control sources), other text boxes autopopulate. I hope this makes sense. I'm sorry to have to tell you it does not make much sense to me. I am unfamiliar either with the real-world business situation you are trying to address or the structure of your database. If you can post a description of the tables and relationships it may be possible to come up with something more definite. "BruceM" wrote: With the VBA editor open, click Debug Compile ___ to compile the code. If you have created a situation such as attempting to requery a field (rather than a control), it will highlight the line of code. It also guards against typographical errors, and quite a few other things that will prevent the code from running. I am not quite sure what to make of something like: control source = Master Item2 = Forms!FrmJob1!ID.Column(7) Is MasterItem2 a combo box? If so, Forms!FrmJob1!ID.Column(7) cannot be its control source. The Control Source is the field to which a control is bound. If you have a Contacts table with fields for FirstName, LastName, etc., and you create a form bound to the Contacts table for entering and editing contact information, then information typed into a text box with its control source set to FirstName will store that information in the FirstName field of the Contacts table. To elaborate a bit, open a form in design view. Click View Properties (or double click the small square at the very top left of the form window). You will see a place for the Record Source. If you select a table or a query bound to the table as the Record Source, the form is a bound form. That is, it is bound to that record source (table or query). The form becomes a sort of portal to the table. Next, the controls. A control is a combo box, text box, label, line, or just about anything else on the form. Some controls, such as text boxes and combo boxes, may be bound to fields in the form's Record Source. That is, a field from the form's Record Source is selected as the control's Control Source. Information entered into the bound control (or selected from a combo box list, which accomplishes the same thing as typing into a text box) will be stored in that field in the form's Record Source. Back to the code you have provided, this cannot do anything I can see: Control Source=PS Item 2= " " (8) Another thing I found puzzling was that you said the info needs to be saved to a new table. Why? It is possible to create a table through code and store information there. I couldn't say exactly how to go about that, but I doubt very much that it is what you need to do. I think a greater understanding of some of the terminology would be of help. A good place to start is he http://allenbrowne.com/tips.html In particular, look at the Table Design links in the Tips for Casual Users. On the right side of the page, toward the bottom of the list, is a Links link. That will take you to quite an extensive list of Access links for users of all levels. "Yula" wrote in message ... Below are my combo boxes: Combo Category = Row Source = Select Query Combo Job = Row Source = Query 5 (Main Query) Cat ID, Cat code, Job Name, Master item, PS item, Master Desc, Price, Master item 2, ps item2, price2, mat2, job cc, contact Combo ID = row source = query 5, event procedure after update text box = count postage = row source = select query postage tab 2 - materials control source = Master Item = Forms!FrmJob1!ID.Column(3) Control Source=PS Item = " " (4) Control Source = Desc = " " (5) Control Source = Price = " " (6) control source = Master Item2 = Forms!FrmJob1!ID.Column(7) Control Source=PS Item 2= " " (8) Control Source = Desc 2= " " (10) Control Source = Price 2= " " (9) Summary Control Source Material A = forms!FrmJob1ID.Column(6)*Forms!frmjob1!count Control Source Material b = forms!FrmJob1ID.Column(9)*Forms!frmjob1!count Control Source OH = Forms!frmjob1!count*.1234 Control Source Postage = Forms!frmjob1!count*Forms!FrmJob1!Postage.column1( 1) I need the user to fill in the info and all the info needs to be saved to a new table. Bruce, I am not sure what you mean by compile the code? Do you mean run? everything works when I click out of design view. I just can't add any records or save it anywhere. "BruceM" wrote: Are the combo boxes and text boxes that are based on queries bound to fields in the form's record source query? Saving the record After Update will not do anything I can see, since updating means the record has been saved. You would be saving it after it has been saved. However, if you wish to force a save during record creation (for instance, if there is validation code in Before Update you may wish to force the Before Update event to run) you can just use Me.Dirty = |
#15
|
|||
|
|||
Records not adding...Please help!
Bruce, Thanks Again. I am finished with the form part of the project, but now
I have to make a report based on the info in the form. I am having trouble adding calculated controls from the form into the report. Ex. My calculated control in a form takes the mailed pieces * cost of material 1. Next control takes mailed pieces * cost of material 2 Material 1 control is named: MaterialA Material 2 control is named: MaterialB I want to take the value from that control and put it into a report that has a label materials and below it there is a calculated control called forms![form1][MaterialA]+ forms![form1][MaterialB] IS this possible?? "BruceM" wrote: Glad to help. Good luck with the project. "Yula" wrote in message ... Bruce, Thank you very much, this was very helpful!!! "BruceM" wrote: It is ususally a good idea to state the nature of the problem. "Something is off" is vague. I noticed a few things. There was an extra 0 before the first instance of the Date. Also, use Is Null, not = Is Null. Be aware that Date is a reserved word in Access, and should not be used for a field name. For a listing of reserved words, see: http://www.accessmvp.com/JConrad/acc...#ReservedWords In particular, look at Reserved Words in Microsoft Access and Reserved Words in Jet 4.0. You can get around using a reserved word by enclosing it in brackets, but sooner or later you will run into a problem with using reserved words incorrectly, and it could be difficult to track down. Having said that, here is your expression, amended. = IIf( [2oz] ="X" and [Date] #5/14/2007#,.545,IIf( [2oz] Is Null and [Date] #5/14/2007#,.321,IIf( [2oz] = "x" and [Date] = #05/14/2007#,.459,IIf( [2oz] Is Null and [Date] = #05/14/2007#,.334)))) You can, however, shorten it to something like: = IIf([2oz] = "X",IIf([Date] #5/14/07#,.545,.459),IIf([2oz] Is Null,IIf([Date] #5/14/07#,.321,.334))) There are only two choices for the date: before 5/14/07, or else on or after 5/14/07. You don't need to test for =, because anything that is not is automatically =. If the only two choices are X or null, you can shorten it to: = IIf([2oz] = "X",IIf([Date] #5/14/07#,.545,.459),IIf([Date] #5/14/07#,.321,.334)) However, if there could be an entry other than X or Null you will need to allow for that in the expression: = IIf([2oz] = "X",IIf([Date] #5/14/07#,.545,.459),IIf([2oz] Is Null,IIf([Date] #5/14/07#,.321,.334),"Other")) If the expression gets much more involved than that you may do well to use VBA, where a wider range of approaches are possible. "Yula" wrote in message ... Bruce, thanks for your advise! The scope of the project changesd direction a bit. I have another questions, maybe you can help me. I am trying to create this IIF statement in a control and something is off, can you take a look at it? = IIf( [2oz] ="X" and [Date] 0#5/14/2007#,.545,IIf( [2oz] = is Null and [Date] #5/14/2007#,.321,IIf( [2oz] = "x" and [Date] =#05/14/2007#,.459,IIf( [2oz] = is Null and [Date] = #05/14/2007#,.334)))) THANK YOU! "BruceM" wrote: Responses inline. "Yula" wrote in message ... Bruce thank you for all your advise so far, but here is the problem. I have been working on this project for a while and I really need to come up with a form for people to fill out that will store the info that they fill in. I don't have the luxury any more to learn more termanology, I have to show something for all the time I out in. I leaned access from scratch and the posts that i found here... and I am sure I know maybe 3% of what's there, but that's not excuse for not getting this project done. A great deal can be accomplished with just a fraction of the capabilities of Access, but a solid design is essential to using Access properly. Without knowing more about how your database is structured or the real-world situation it is trying to addess I may not be able to offer many useful suggestions. Much can be accomplished with Access, but there is a substantial learning curve. You may not have enough knowledge of the product to get the particular job done. By analogy, having a learner's permit, and being familiar with the basics of putting a car into gear and steering it around the neighborhood, does not qualify you to take part in a road rally. It's not an excuse, it's a fact. To answer your questions: I ran the compile in VBA and there was one problem, I took care of it. When I say Control source = master Item #=forms!FrmJob1ID.Column(7), I mean by that the control source in the properties sheet for that text box is called master item #. For what text box? What is Forms!frmJob1ID.Column(7)? Also, I don't think I would need a "contact" table to be updated b/c the user is selecting from a given list of operators. When they select the operator from the combo box, other text boxes are automatically populated. The Contacts table was an example: "If you have a Contacts table ...". It is a familiar situation, so I had hoped it would be useful as an example. Ex. Combo box Operator. Row souce in properties is called operator query Column 1 shows: Bob, John, Joe, Mike What is the source for the operator query? Is there an Employee table or something of the sort? Machine they work on text box: autopopulates 12345 (based on Operator query column 2) Each operator works on just one machine? Do you mean they operate the machine, or is this a shop that repairs machines? "Work on" is a vague term. In any case, "machine they work on" is not an attribute of an operator, so the information should be stored in a separate table. If that is already the case, and the operator query assembles information from several tables, the question remains whether you need to store the information about machine and shift, or just link to it. Shift they work, text box autopopulates 1 (based on operator query column 3) That's pretty much the set up for this form. When the user selects something from the combo box(based on row sources and the text boxes based on control sources), other text boxes autopopulate. I hope this makes sense. I'm sorry to have to tell you it does not make much sense to me. I am unfamiliar either with the real-world business situation you are trying to address or the structure of your database. If you can post a description of the tables and relationships it may be possible to come up with something more definite. "BruceM" wrote: With the VBA editor open, click Debug Compile ___ to compile the code. If you have created a situation such as attempting to requery a field (rather than a control), it will highlight the line of code. It also guards against typographical errors, and quite a few other things that will prevent the code from running. I am not quite sure what to make of something like: control source = Master Item2 = Forms!FrmJob1!ID.Column(7) Is MasterItem2 a combo box? If so, Forms!FrmJob1!ID.Column(7) cannot be its control source. The Control Source is the field to which a control is bound. If you have a Contacts table with fields for FirstName, LastName, etc., and you create a form bound to the Contacts table for entering and editing contact information, then information typed into a text box with its control source set to FirstName will store that information in the FirstName field of the Contacts table. To elaborate a bit, open a form in design view. Click View Properties (or double click the small square at the very top left of the form window). You will see a place for the Record Source. If you select a table or a query bound to the table as the Record Source, the form is a bound form. That is, it is bound to that record source (table or query). The form becomes a sort of portal to the table. Next, the controls. A control is a combo box, text box, label, line, or just about anything else on the form. Some controls, such as text boxes and combo boxes, may be bound to fields in the form's Record Source. That is, a field from the form's Record Source is selected as the control's Control Source. Information entered into the bound control (or selected from a combo box list, which accomplishes the same thing as typing into a text box) will be stored in that field in the form's Record Source. Back to the code you have provided, this cannot do anything I can see: Control Source=PS Item 2= " " (8) Another thing I found puzzling was that you said the info needs to be saved to a new table. Why? It is possible to create a table through code and store information there. I couldn't say exactly how to go about that, but I doubt very much that it is what you need to do. I think a greater understanding of some of the terminology would be of help. A good place to start is he http://allenbrowne.com/tips.html In particular, look at the Table Design links in the Tips for Casual Users. On the right side of the page, toward the bottom of the list, is a Links link. That will take you to quite an extensive list of Access links for users of all levels. "Yula" wrote in message ... Below are my combo boxes: Combo Category = Row Source = Select Query Combo Job = Row Source = Query 5 (Main Query) Cat ID, Cat code, Job Name, Master item, PS item, Master Desc, Price, Master item 2, ps item2, price2, mat2, job cc, contact Combo ID = row source = query 5, event procedure after update text box = count |
#16
|
|||
|
|||
Records not adding...Please help!
The syntax for referencing a field on another form is:
[Forms]![Form1]![MaterialA] I'm not sure if it is necessary to put square brackets around Forms, but note that you left out an exclamation mark (aka "bang"). If the report is based on the same record source as the form you could also just repeat the calculation in the report. Although I don't know the purpose of your database, when I see that there is something like MaterialA and MaterialB I wonder if you are thinking in spreadsheet terms and storing a wide range of information in a flat file. Unless there are always a fixed number of entries (and maybe even if there are) it is usually better to store such information in a separate related table. "Yula" wrote in message ... Bruce, Thanks Again. I am finished with the form part of the project, but now I have to make a report based on the info in the form. I am having trouble adding calculated controls from the form into the report. Ex. My calculated control in a form takes the mailed pieces * cost of material 1. Next control takes mailed pieces * cost of material 2 Material 1 control is named: MaterialA Material 2 control is named: MaterialB I want to take the value from that control and put it into a report that has a label materials and below it there is a calculated control called forms![form1][MaterialA]+ forms![form1][MaterialB] IS this possible?? "BruceM" wrote: Glad to help. Good luck with the project. "Yula" wrote in message ... Bruce, Thank you very much, this was very helpful!!! "BruceM" wrote: It is ususally a good idea to state the nature of the problem. "Something is off" is vague. I noticed a few things. There was an extra 0 before the first instance of the Date. Also, use Is Null, not = Is Null. Be aware that Date is a reserved word in Access, and should not be used for a field name. For a listing of reserved words, see: http://www.accessmvp.com/JConrad/acc...#ReservedWords In particular, look at Reserved Words in Microsoft Access and Reserved Words in Jet 4.0. You can get around using a reserved word by enclosing it in brackets, but sooner or later you will run into a problem with using reserved words incorrectly, and it could be difficult to track down. Having said that, here is your expression, amended. = IIf( [2oz] ="X" and [Date] #5/14/2007#,.545,IIf( [2oz] Is Null and [Date] #5/14/2007#,.321,IIf( [2oz] = "x" and [Date] = #05/14/2007#,.459,IIf( [2oz] Is Null and [Date] = #05/14/2007#,.334)))) You can, however, shorten it to something like: = IIf([2oz] = "X",IIf([Date] #5/14/07#,.545,.459),IIf([2oz] Is Null,IIf([Date] #5/14/07#,.321,.334))) There are only two choices for the date: before 5/14/07, or else on or after 5/14/07. You don't need to test for =, because anything that is not is automatically =. If the only two choices are X or null, you can shorten it to: = IIf([2oz] = "X",IIf([Date] #5/14/07#,.545,.459),IIf([Date] #5/14/07#,.321,.334)) However, if there could be an entry other than X or Null you will need to allow for that in the expression: = IIf([2oz] = "X",IIf([Date] #5/14/07#,.545,.459),IIf([2oz] Is Null,IIf([Date] #5/14/07#,.321,.334),"Other")) If the expression gets much more involved than that you may do well to use VBA, where a wider range of approaches are possible. "Yula" wrote in message ... Bruce, thanks for your advise! The scope of the project changesd direction a bit. I have another questions, maybe you can help me. I am trying to create this IIF statement in a control and something is off, can you take a look at it? = IIf( [2oz] ="X" and [Date] 0#5/14/2007#,.545,IIf( [2oz] = is Null and [Date] #5/14/2007#,.321,IIf( [2oz] = "x" and [Date] =#05/14/2007#,.459,IIf( [2oz] = is Null and [Date] = #05/14/2007#,.334)))) THANK YOU! "BruceM" wrote: Responses inline. "Yula" wrote in message ... Bruce thank you for all your advise so far, but here is the problem. I have been working on this project for a while and I really need to come up with a form for people to fill out that will store the info that they fill in. I don't have the luxury any more to learn more termanology, I have to show something for all the time I out in. I leaned access from scratch and the posts that i found here... and I am sure I know maybe 3% of what's there, but that's not excuse for not getting this project done. A great deal can be accomplished with just a fraction of the capabilities of Access, but a solid design is essential to using Access properly. Without knowing more about how your database is structured or the real-world situation it is trying to addess I may not be able to offer many useful suggestions. Much can be accomplished with Access, but there is a substantial learning curve. You may not have enough knowledge of the product to get the particular job done. By analogy, having a learner's permit, and being familiar with the basics of putting a car into gear and steering it around the neighborhood, does not qualify you to take part in a road rally. It's not an excuse, it's a fact. To answer your questions: I ran the compile in VBA and there was one problem, I took care of it. When I say Control source = master Item #=forms!FrmJob1ID.Column(7), I mean by that the control source in the properties sheet for that text box is called master item #. For what text box? What is Forms!frmJob1ID.Column(7)? Also, I don't think I would need a "contact" table to be updated b/c the user is selecting from a given list of operators. When they select the operator from the combo box, other text boxes are automatically populated. The Contacts table was an example: "If you have a Contacts table ...". It is a familiar situation, so I had hoped it would be useful as an example. Ex. Combo box Operator. Row souce in properties is called operator query Column 1 shows: Bob, John, Joe, Mike What is the source for the operator query? Is there an Employee table or something of the sort? Machine they work on text box: autopopulates 12345 (based on Operator query column 2) Each operator works on just one machine? Do you mean they operate the machine, or is this a shop that repairs machines? "Work on" is a vague term. In any case, "machine they work on" is not an attribute of an operator, so the information should be stored in a separate table. If that is already the case, and the operator query assembles information from several tables, the question remains whether you need to store the information about machine and shift, or just link to it. Shift they work, text box autopopulates 1 (based on operator query column 3) That's pretty much the set up for this form. When the user selects something from the combo box(based on row sources and the text boxes based on control sources), other text boxes autopopulate. I hope this makes sense. I'm sorry to have to tell you it does not make much sense to me. I am unfamiliar either with the real-world business situation you are trying to address or the structure of your database. If you can post a description of the tables and relationships it may be possible to come up with something more definite. "BruceM" wrote: With the VBA editor open, click Debug Compile ___ to compile the code. If you have created a situation such as attempting to requery a field (rather than a control), it will highlight the line of code. It also guards against typographical errors, and quite a few other things that will prevent the code from running. I am not quite sure what to make of something like: control source = Master Item2 = Forms!FrmJob1!ID.Column(7) Is MasterItem2 a combo box? If so, Forms!FrmJob1!ID.Column(7) cannot be its control source. The Control Source is the field to which a control is bound. If you have a Contacts table with fields for FirstName, LastName, etc., and you create a form bound to the Contacts table for entering and editing contact information, then information typed into a text box with its control source set to FirstName will store that information in the FirstName field of the Contacts table. To elaborate a bit, open a form in design view. Click View Properties (or double click the small square at the very top left of the form window). You will see a place for the Record Source. If you select a table or a query bound to the table as the Record Source, the form is a bound form. That is, it is bound to that record source (table or query). The form becomes a sort of portal to the table. Next, the controls. A control is a combo box, text box, label, line, or just about anything else on the form. Some controls, such as text boxes and combo boxes, may be bound to fields in the form's Record Source. That is, a field from the form's Record Source is selected as the control's Control Source. Information entered into the bound control (or selected from a combo box list, which accomplishes the same thing as typing into a text box) will be stored in that field in the form's Record Source. Back to the code you have provided, this cannot do anything I can see: Control Source=PS Item 2= " " (8) Another thing I found puzzling was that you said the info needs to be saved to a new table. Why? It is possible to create a table through code and store information there. I couldn't say exactly how to go about that, but I doubt very much that it is what you need to do. I think a greater understanding of some of the terminology would be of help. A good place to start is he http://allenbrowne.com/tips.html In particular, look at the Table Design links in the Tips for Casual Users. On the right side of the page, toward the bottom of the list, is a Links link. That will take you to quite an extensive list of Access links for users of all levels. "Yula" wrote in message ... Below are my combo boxes: Combo Category = Row Source = Select Query Combo Job = Row Source = Query 5 (Main Query) Cat ID, Cat code, Job Name, Master item, PS item, Master Desc, Price, Master item 2, ps item2, price2, mat2, job cc, contact Combo ID = row source = query 5, event procedure after update text box = count |
#17
|
|||
|
|||
Records not adding...Please help!
Thanks Bruce, I figured this one out. I have yet another questions about an
IIF statement. I need a calculated field based on the following criteria: Previous calculation in this field: PSI: IIF([x is 2oz] ="p",0,[mailed pieces ] *.011) -- This was working fine until I found out that I have to change the constant based on the date. I need the same formula only before 5/14/2007 *.013 and after 5/14/2007 its *.011. I know you showed me something similar,but I am not sure where the first part (([x is 2oz] ="p",0)fits into that previous formula. Thanks again for ALL your help Bruce! Yula "BruceM" wrote: The syntax for referencing a field on another form is: [Forms]![Form1]![MaterialA] I'm not sure if it is necessary to put square brackets around Forms, but note that you left out an exclamation mark (aka "bang"). If the report is based on the same record source as the form you could also just repeat the calculation in the report. Although I don't know the purpose of your database, when I see that there is something like MaterialA and MaterialB I wonder if you are thinking in spreadsheet terms and storing a wide range of information in a flat file. Unless there are always a fixed number of entries (and maybe even if there are) it is usually better to store such information in a separate related table. "Yula" wrote in message ... Bruce, Thanks Again. I am finished with the form part of the project, but now I have to make a report based on the info in the form. I am having trouble adding calculated controls from the form into the report. Ex. My calculated control in a form takes the mailed pieces * cost of material 1. Next control takes mailed pieces * cost of material 2 Material 1 control is named: MaterialA Material 2 control is named: MaterialB I want to take the value from that control and put it into a report that has a label materials and below it there is a calculated control called forms![form1][MaterialA]+ forms![form1][MaterialB] IS this possible?? "BruceM" wrote: Glad to help. Good luck with the project. "Yula" wrote in message ... Bruce, Thank you very much, this was very helpful!!! "BruceM" wrote: It is ususally a good idea to state the nature of the problem. "Something is off" is vague. I noticed a few things. There was an extra 0 before the first instance of the Date. Also, use Is Null, not = Is Null. Be aware that Date is a reserved word in Access, and should not be used for a field name. For a listing of reserved words, see: http://www.accessmvp.com/JConrad/acc...#ReservedWords In particular, look at Reserved Words in Microsoft Access and Reserved Words in Jet 4.0. You can get around using a reserved word by enclosing it in brackets, but sooner or later you will run into a problem with using reserved words incorrectly, and it could be difficult to track down. Having said that, here is your expression, amended. = IIf( [2oz] ="X" and [Date] #5/14/2007#,.545,IIf( [2oz] Is Null and [Date] #5/14/2007#,.321,IIf( [2oz] = "x" and [Date] = #05/14/2007#,.459,IIf( [2oz] Is Null and [Date] = #05/14/2007#,.334)))) You can, however, shorten it to something like: = IIf([2oz] = "X",IIf([Date] #5/14/07#,.545,.459),IIf([2oz] Is Null,IIf([Date] #5/14/07#,.321,.334))) There are only two choices for the date: before 5/14/07, or else on or after 5/14/07. You don't need to test for =, because anything that is not is automatically =. If the only two choices are X or null, you can shorten it to: = IIf([2oz] = "X",IIf([Date] #5/14/07#,.545,.459),IIf([Date] #5/14/07#,.321,.334)) However, if there could be an entry other than X or Null you will need to allow for that in the expression: = IIf([2oz] = "X",IIf([Date] #5/14/07#,.545,.459),IIf([2oz] Is Null,IIf([Date] #5/14/07#,.321,.334),"Other")) If the expression gets much more involved than that you may do well to use VBA, where a wider range of approaches are possible. "Yula" wrote in message ... Bruce, thanks for your advise! The scope of the project changesd direction a bit. I have another questions, maybe you can help me. I am trying to create this IIF statement in a control and something is off, can you take a look at it? = IIf( [2oz] ="X" and [Date] 0#5/14/2007#,.545,IIf( [2oz] = is Null and [Date] #5/14/2007#,.321,IIf( [2oz] = "x" and [Date] =#05/14/2007#,.459,IIf( [2oz] = is Null and [Date] = #05/14/2007#,.334)))) THANK YOU! "BruceM" wrote: Responses inline. "Yula" wrote in message ... Bruce thank you for all your advise so far, but here is the problem. I have been working on this project for a while and I really need to come up with a form for people to fill out that will store the info that they fill in. I don't have the luxury any more to learn more termanology, I have to show something for all the time I out in. I leaned access from scratch and the posts that i found here... and I am sure I know maybe 3% of what's there, but that's not excuse for not getting this project done. A great deal can be accomplished with just a fraction of the capabilities of Access, but a solid design is essential to using Access properly. Without knowing more about how your database is structured or the real-world situation it is trying to addess I may not be able to offer many useful suggestions. Much can be accomplished with Access, but there is a substantial learning curve. You may not have enough knowledge of the product to get the particular job done. By analogy, having a learner's permit, and being familiar with the basics of putting a car into gear and steering it around the neighborhood, does not qualify you to take part in a road rally. It's not an excuse, it's a fact. To answer your questions: I ran the compile in VBA and there was one problem, I took care of it. When I say Control source = master Item #=forms!FrmJob1ID.Column(7), I mean by that the control source in the properties sheet for that text box is called master item #. For what text box? What is Forms!frmJob1ID.Column(7)? Also, I don't think I would need a "contact" table to be updated b/c the user is selecting from a given list of operators. When they select the operator from the combo box, other text boxes are automatically populated. The Contacts table was an example: "If you have a Contacts table ...". It is a familiar situation, so I had hoped it would be useful as an example. Ex. Combo box Operator. Row souce in properties is called operator query Column 1 shows: Bob, John, Joe, Mike What is the source for the operator query? Is there an Employee table or something of the sort? Machine they work on text box: autopopulates 12345 (based on Operator query column 2) Each operator works on just one machine? Do you mean they operate the machine, or is this a shop that repairs machines? "Work on" is a vague term. In any case, "machine they work on" is not an attribute of an operator, so the information should be stored in a separate table. If that is already the case, and the operator query assembles information from several tables, the question remains whether you need to store the information about machine and shift, or just link to it. Shift they work, text box autopopulates 1 (based on operator query column 3) That's pretty much the set up for this form. When the user selects something from the combo box(based on row sources and the text boxes based on control sources), other text boxes autopopulate. I hope this makes sense. I'm sorry to have to tell you it does not make much sense to me. I am unfamiliar either with the real-world business situation you are trying to address or the structure of your database. If you can post a description of the tables and relationships it may be possible to come up with something more definite. "BruceM" wrote: With the VBA editor open, click Debug Compile ___ to compile the code. If you have created a situation such as attempting to requery a field (rather than a control), it will highlight the line of code. It also guards against typographical errors, and quite a few other things that will prevent the code from running. I am not quite sure what to make of something like: control source = Master Item2 = Forms!FrmJob1!ID.Column(7) Is MasterItem2 a combo box? If so, Forms!FrmJob1!ID.Column(7) cannot be its control source. The Control Source is the field to which a control is bound. If you have a Contacts table with fields for FirstName, LastName, etc., and you create a form bound to the Contacts table for entering and editing contact information, then information typed into a text box with its control source set to FirstName will store that information in the FirstName field of the Contacts table. To elaborate a bit, open a form in design view. Click View Properties (or double click the small square at the very top left of the form window). |
#18
|
|||
|
|||
Records not adding...Please help!
Just substitute another IIf for the number:
PSI: IIF([x is 2oz] ="p",0,[mailed pieces ] * IIf([DateField] = #5/14/07#,.013,.011)) As an aside, you will probably find it helpful over time to keep spaces and special characters other than undrscores out of field names. "Yula" wrote in message ... Thanks Bruce, I figured this one out. I have yet another questions about an IIF statement. I need a calculated field based on the following criteria: Previous calculation in this field: PSI: IIF([x is 2oz] ="p",0,[mailed pieces ] *.011) -- This was working fine until I found out that I have to change the constant based on the date. I need the same formula only before 5/14/2007 *.013 and after 5/14/2007 its *.011. I know you showed me something similar,but I am not sure where the first part (([x is 2oz] ="p",0)fits into that previous formula. Thanks again for ALL your help Bruce! Yula "BruceM" wrote: The syntax for referencing a field on another form is: [Forms]![Form1]![MaterialA] I'm not sure if it is necessary to put square brackets around Forms, but note that you left out an exclamation mark (aka "bang"). If the report is based on the same record source as the form you could also just repeat the calculation in the report. Although I don't know the purpose of your database, when I see that there is something like MaterialA and MaterialB I wonder if you are thinking in spreadsheet terms and storing a wide range of information in a flat file. Unless there are always a fixed number of entries (and maybe even if there are) it is usually better to store such information in a separate related table. "Yula" wrote in message ... Bruce, Thanks Again. I am finished with the form part of the project, but now I have to make a report based on the info in the form. I am having trouble adding calculated controls from the form into the report. Ex. My calculated control in a form takes the mailed pieces * cost of material 1. Next control takes mailed pieces * cost of material 2 Material 1 control is named: MaterialA Material 2 control is named: MaterialB I want to take the value from that control and put it into a report that has a label materials and below it there is a calculated control called forms![form1][MaterialA]+ forms![form1][MaterialB] IS this possible?? "BruceM" wrote: Glad to help. Good luck with the project. "Yula" wrote in message ... Bruce, Thank you very much, this was very helpful!!! "BruceM" wrote: It is ususally a good idea to state the nature of the problem. "Something is off" is vague. I noticed a few things. There was an extra 0 before the first instance of the Date. Also, use Is Null, not = Is Null. Be aware that Date is a reserved word in Access, and should not be used for a field name. For a listing of reserved words, see: http://www.accessmvp.com/JConrad/acc...#ReservedWords In particular, look at Reserved Words in Microsoft Access and Reserved Words in Jet 4.0. You can get around using a reserved word by enclosing it in brackets, but sooner or later you will run into a problem with using reserved words incorrectly, and it could be difficult to track down. Having said that, here is your expression, amended. = IIf( [2oz] ="X" and [Date] #5/14/2007#,.545,IIf( [2oz] Is Null and [Date] #5/14/2007#,.321,IIf( [2oz] = "x" and [Date] = #05/14/2007#,.459,IIf( [2oz] Is Null and [Date] = #05/14/2007#,.334)))) You can, however, shorten it to something like: = IIf([2oz] = "X",IIf([Date] #5/14/07#,.545,.459),IIf([2oz] Is Null,IIf([Date] #5/14/07#,.321,.334))) There are only two choices for the date: before 5/14/07, or else on or after 5/14/07. You don't need to test for =, because anything that is not is automatically =. If the only two choices are X or null, you can shorten it to: = IIf([2oz] = "X",IIf([Date] #5/14/07#,.545,.459),IIf([Date] #5/14/07#,.321,.334)) However, if there could be an entry other than X or Null you will need to allow for that in the expression: = IIf([2oz] = "X",IIf([Date] #5/14/07#,.545,.459),IIf([2oz] Is Null,IIf([Date] #5/14/07#,.321,.334),"Other")) If the expression gets much more involved than that you may do well to use VBA, where a wider range of approaches are possible. "Yula" wrote in message ... Bruce, thanks for your advise! The scope of the project changesd direction a bit. I have another questions, maybe you can help me. I am trying to create this IIF statement in a control and something is off, can you take a look at it? = IIf( [2oz] ="X" and [Date] 0#5/14/2007#,.545,IIf( [2oz] = is Null and [Date] #5/14/2007#,.321,IIf( [2oz] = "x" and [Date] =#05/14/2007#,.459,IIf( [2oz] = is Null and [Date] = #05/14/2007#,.334)))) THANK YOU! "BruceM" wrote: Responses inline. "Yula" wrote in message ... Bruce thank you for all your advise so far, but here is the problem. I have been working on this project for a while and I really need to come up with a form for people to fill out that will store the info that they fill in. I don't have the luxury any more to learn more termanology, I have to show something for all the time I out in. I leaned access from scratch and the posts that i found here... and I am sure I know maybe 3% of what's there, but that's not excuse for not getting this project done. A great deal can be accomplished with just a fraction of the capabilities of Access, but a solid design is essential to using Access properly. Without knowing more about how your database is structured or the real-world situation it is trying to addess I may not be able to offer many useful suggestions. Much can be accomplished with Access, but there is a substantial learning curve. You may not have enough knowledge of the product to get the particular job done. By analogy, having a learner's permit, and being familiar with the basics of putting a car into gear and steering it around the neighborhood, does not qualify you to take part in a road rally. It's not an excuse, it's a fact. To answer your questions: I ran the compile in VBA and there was one problem, I took care of it. When I say Control source = master Item #=forms!FrmJob1ID.Column(7), I mean by that the control source in the properties sheet for that text box is called master item #. For what text box? What is Forms!frmJob1ID.Column(7)? Also, I don't think I would need a "contact" table to be updated b/c the user is selecting from a given list of operators. When they select the operator from the combo box, other text boxes are automatically populated. The Contacts table was an example: "If you have a Contacts table ...". It is a familiar situation, so I had hoped it would be useful as an example. Ex. Combo box Operator. Row souce in properties is called operator query Column 1 shows: Bob, John, Joe, Mike What is the source for the operator query? Is there an Employee table or something of the sort? Machine they work on text box: autopopulates 12345 (based on Operator query column 2) Each operator works on just one machine? Do you mean they operate the machine, or is this a shop that repairs machines? "Work on" is a vague term. In any case, "machine they work on" is not an attribute of an operator, so the information should be stored in a separate table. If that is already the case, and the operator query assembles information from several tables, the question remains whether you need to store the information about machine and shift, or just link to it. Shift they work, text box autopopulates 1 (based on operator query column 3) That's pretty much the set up for this form. When the user selects something from the combo box(based on row sources and the text boxes based on control sources), other text boxes autopopulate. I hope this makes sense. I'm sorry to have to tell you it does not make much sense to me. I am unfamiliar either with the real-world business situation you are trying to address or the structure of your database. If you can post a description of the tables and relationships it may be possible to come up with something more definite. "BruceM" wrote: With the VBA editor open, click Debug Compile ___ to compile the code. If you have created a situation such as attempting to requery a field (rather than a control), it will highlight the line of code. It also guards against typographical errors, and quite a few other things that will prevent the code from running. I am not quite sure what to make of something like: control source = Master Item2 = Forms!FrmJob1!ID.Column(7) Is MasterItem2 a combo box? If so, Forms!FrmJob1!ID.Column(7) cannot be its control source. The Control Source is the field to which a control is bound. If you have a Contacts table with fields for FirstName, LastName, etc., and you create a form bound to the Contacts table for entering and editing contact information, then information typed into a text box with its control source set to FirstName will store that information in the FirstName field of the Contacts table. To elaborate a bit, open a form in design view. Click View Properties (or double click the small square at the very top left of the form window). |
#19
|
|||
|
|||
Records not adding...Please help!
Thank you on once again. I can think thru the logic, I am just having a hard
time with the syntex. "BruceM" wrote: Just substitute another IIf for the number: PSI: IIF([x is 2oz] ="p",0,[mailed pieces ] * IIf([DateField] = #5/14/07#,.013,.011)) As an aside, you will probably find it helpful over time to keep spaces and special characters other than undrscores out of field names. "Yula" wrote in message ... Thanks Bruce, I figured this one out. I have yet another questions about an IIF statement. I need a calculated field based on the following criteria: Previous calculation in this field: PSI: IIF([x is 2oz] ="p",0,[mailed pieces ] *.011) -- This was working fine until I found out that I have to change the constant based on the date. I need the same formula only before 5/14/2007 *.013 and after 5/14/2007 its *.011. I know you showed me something similar,but I am not sure where the first part (([x is 2oz] ="p",0)fits into that previous formula. Thanks again for ALL your help Bruce! Yula "BruceM" wrote: The syntax for referencing a field on another form is: [Forms]![Form1]![MaterialA] I'm not sure if it is necessary to put square brackets around Forms, but note that you left out an exclamation mark (aka "bang"). If the report is based on the same record source as the form you could also just repeat the calculation in the report. Although I don't know the purpose of your database, when I see that there is something like MaterialA and MaterialB I wonder if you are thinking in spreadsheet terms and storing a wide range of information in a flat file. Unless there are always a fixed number of entries (and maybe even if there are) it is usually better to store such information in a separate related table. "Yula" wrote in message ... Bruce, Thanks Again. I am finished with the form part of the project, but now I have to make a report based on the info in the form. I am having trouble adding calculated controls from the form into the report. Ex. My calculated control in a form takes the mailed pieces * cost of material 1. Next control takes mailed pieces * cost of material 2 Material 1 control is named: MaterialA Material 2 control is named: MaterialB I want to take the value from that control and put it into a report that has a label materials and below it there is a calculated control called forms![form1][MaterialA]+ forms![form1][MaterialB] IS this possible?? "BruceM" wrote: Glad to help. Good luck with the project. "Yula" wrote in message ... Bruce, Thank you very much, this was very helpful!!! "BruceM" wrote: It is ususally a good idea to state the nature of the problem. "Something is off" is vague. I noticed a few things. There was an extra 0 before the first instance of the Date. Also, use Is Null, not = Is Null. Be aware that Date is a reserved word in Access, and should not be used for a field name. For a listing of reserved words, see: http://www.accessmvp.com/JConrad/acc...#ReservedWords In particular, look at Reserved Words in Microsoft Access and Reserved Words in Jet 4.0. You can get around using a reserved word by enclosing it in brackets, but sooner or later you will run into a problem with using reserved words incorrectly, and it could be difficult to track down. Having said that, here is your expression, amended. = IIf( [2oz] ="X" and [Date] #5/14/2007#,.545,IIf( [2oz] Is Null and [Date] #5/14/2007#,.321,IIf( [2oz] = "x" and [Date] = #05/14/2007#,.459,IIf( [2oz] Is Null and [Date] = #05/14/2007#,.334)))) You can, however, shorten it to something like: = IIf([2oz] = "X",IIf([Date] #5/14/07#,.545,.459),IIf([2oz] Is Null,IIf([Date] #5/14/07#,.321,.334))) There are only two choices for the date: before 5/14/07, or else on or after 5/14/07. You don't need to test for =, because anything that is not is automatically =. If the only two choices are X or null, you can shorten it to: = IIf([2oz] = "X",IIf([Date] #5/14/07#,.545,.459),IIf([Date] #5/14/07#,.321,.334)) However, if there could be an entry other than X or Null you will need to allow for that in the expression: = IIf([2oz] = "X",IIf([Date] #5/14/07#,.545,.459),IIf([2oz] Is Null,IIf([Date] #5/14/07#,.321,.334),"Other")) If the expression gets much more involved than that you may do well to use VBA, where a wider range of approaches are possible. "Yula" wrote in message ... Bruce, thanks for your advise! The scope of the project changesd direction a bit. I have another questions, maybe you can help me. I am trying to create this IIF statement in a control and something is off, can you take a look at it? = IIf( [2oz] ="X" and [Date] 0#5/14/2007#,.545,IIf( [2oz] = is Null and [Date] #5/14/2007#,.321,IIf( [2oz] = "x" and [Date] =#05/14/2007#,.459,IIf( [2oz] = is Null and [Date] = #05/14/2007#,.334)))) THANK YOU! "BruceM" wrote: Responses inline. "Yula" wrote in message ... Bruce thank you for all your advise so far, but here is the problem. I have been working on this project for a while and I really need to come up with a form for people to fill out that will store the info that they fill in. I don't have the luxury any more to learn more termanology, I have to show something for all the time I out in. I leaned access from scratch and the posts that i found here... and I am sure I know maybe 3% of what's there, but that's not excuse for not getting this project done. A great deal can be accomplished with just a fraction of the capabilities of Access, but a solid design is essential to using Access properly. Without knowing more about how your database is structured or the real-world situation it is trying to addess I may not be able to offer many useful suggestions. Much can be accomplished with Access, but there is a substantial learning curve. You may not have enough knowledge of the product to get the particular job done. By analogy, having a learner's permit, and being familiar with the basics of putting a car into gear and steering it around the neighborhood, does not qualify you to take part in a road rally. It's not an excuse, it's a fact. To answer your questions: I ran the compile in VBA and there was one problem, I took care of it. When I say Control source = master Item #=forms!FrmJob1ID.Column(7), I mean by that the control source in the properties sheet for that text box is called master item #. For what text box? What is Forms!frmJob1ID.Column(7)? Also, I don't think I would need a "contact" table to be updated b/c the user is selecting from a given list of operators. When they select the operator from the combo box, other text boxes are automatically populated. The Contacts table was an example: "If you have a Contacts table ...". It is a familiar situation, so I had hoped it would be useful as an example. Ex. Combo box Operator. Row souce in properties is called operator query Column 1 shows: Bob, John, Joe, Mike What is the source for the operator query? Is there an Employee table or something of the sort? Machine they work on text box: autopopulates 12345 (based on Operator query column 2) Each operator works on just one machine? Do you mean they operate the machine, or is this a shop that repairs machines? "Work on" is a vague term. In any case, "machine they work on" is not an attribute of an operator, so the information should be stored in a separate table. If that is already the case, and the operator query assembles information from several tables, the question remains whether you need to store the information about machine and shift, or just link to it. |
|
Thread Tools | |
Display Modes | |
|
|