Hello.
I have a form (frmPermits) that is based upon a query (qryPermits). The form has a combobox (cboRecNum) that is also based on a query (qryCboRecNum). The idea is that the user will select an item from cboRecNum, which is populated from a field in TableA. Then, the rest of the form is filled out based on corresponding fields in TableB after executing qyrPermits. This is done via an me.requery in the AfterUpdate for the cbo.
All of this works well. It returns all those records from TableB that have the same field value selected from TableA (TableA is polulated before hand using a separate form, of course). It will even allow one to add a blank record whose new field values populate TbaleB. So far, so good.
The problem comes in when there are no records in TableB that match the cbo selection from TableA. I understand that the query should not return any records - there are none. But, I would like the user to be able to create a new record to go into TableB that has an entry that will then correspond to the cbo selection, which, again, is from TableA.
Unfortuntately, I cannot figure out how to do this correctly. I've tried counting the number of records returned by the qryCboRecNum, but can't seem to get that right and even if I could I'm not sure how to add a new blank record.
Can someone help me, please? I have a rather small database (<700K, zipped) that I would be happy to send via email if it would help - there is no confidential information included.
I look forward to your assistance.
To
I have a form (frmPermits) that is based upon a query (qryPermits). The form has a combobox (cboRecNum) that is also based on a query (qryCboRecNum). The idea is that the user will select an item from cboRecNum, which is populated from a field in TableA. Then, the rest of the form is filled out based on corresponding fields in TableB after executing qyrPermits. This is done via an me.requery in the AfterUpdate for the cbo.
All of this works well. It returns all those records from TableB that have the same field value selected from TableA (TableA is polulated before hand using a separate form, of course). It will even allow one to add a blank record whose new field values populate TbaleB. So far, so good.
The problem comes in when there are no records in TableB that match the cbo selection from TableA. I understand that the query should not return any records - there are none. But, I would like the user to be able to create a new record to go into TableB that has an entry that will then correspond to the cbo selection, which, again, is from TableA.
Unfortuntately, I cannot figure out how to do this correctly. I've tried counting the number of records returned by the qryCboRecNum, but can't seem to get that right and even if I could I'm not sure how to add a new blank record.
Can someone help me, please? I have a rather small database (<700K, zipped) that I would be happy to send via email if it would help - there is no confidential information included.
I look forward to your assistance.
To