To make changes to this field, first save the record

emphyda

Registered User.
Local time
Today, 21:35
Joined
Jun 2, 2013
Messages
12
Hi all,
I need someone to help. I have an input sub form from a query drawn from two tables. I also have two bound combo boxes; the first filters for the second. The AfterUpdate Event in the first combo box is

Private Sub CboCategory_AfterUpdate()
' Update the row source of the cboDrug combo box
' when the user makes a selection in the cboCategory
' combo box.
Me.CboDrug.RowSource = "SELECT Drg_Id FROM" & _
" Sales_Details WHERE Category = " & _
Me.CboCategory & _
" ORDER BY Drg_Id"
Me.CboDrug.Requery
End Sub
The above is working fine as I can select my category. My problem is with the second combo box with the filtered list. Attempt to select from the list gives "To make changes to this field, first save the record.''
How can I solve it as I have tried adding this;
DoCmd.RunCommand acCmdSaveRecord on Form Load event. If the reason is because of the query, I need help on how to circumvent it.

Thank you for the quick response(s).
 
Hi Pat,
I substituted your suggestion in the rowsource of the second combo box and removed all the codes except Me.CboDrug.Requery, It did not work.
Could you please explain to me, what record does it want saved before accepting changes?

Let me give you an insight of what I am doing. I am Preparing a sales Invoice form. I have the Master table, the Detail table and the Sales_Details table. The Master table has automated invoice numbers and date Fields
while the Detail table has the invoice number, the Qty and the Drug_Id Fields.
The sales_Detail table has Fields such as Category, Drg_Name, CostP, SaleP, Available Qty, and Updated_Qty. These tables have perfect one to many relationships.

In order to present all I want in my subform which will be in dataview, I have to use query to pull fields from the Detail and Sales_Details tables.

Up to this point, I have no issues. My problem started when I introduced 2 bound combo boxes in the form, one to select category and the other to filter the list. The first box is okay while my headache for about three days now is in the second box.

I hope you understand where I am coming from to be able to help me.

Thanks
 
What I meant by it did not work is that I still got the error message; To make changes to this field, first save the record.
The SQL for the rowsource is
SELECT Sales_Details.Drg_Id FROM Sales_Details WHERE Category=Forms!Frmdetail1!CboCategory ORDER BY Drg_Id;

The code beforeUpdate is
Me.CboDrug.Requery.

Thank you for the effort so far.
Emphyda
 

Users who are viewing this thread

Back
Top Bottom