RE: CBO Selection utilizing the same table
- From: Klatuu <Klatuu@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 16 Jan 2007 06:51:00 -0800
99 times out of 100, using bound combo boxes for searching is a bad idea.
I would suggest using a sequential number to identify each "redo" of an
audit. Use the IDAudit and the New "AuditVersion" as a composite primary key.
Make your bound fields text boxes on the form. Make you combo unbound. It
should have two fields, the IDAudit and Audit Version. That way the user can
select the audit and the version from the combo.
To handle the sequencing, here is some code that determines the next number
to use:
Me.txtAuditVersion = Nz(DLookup("[AuditVersion]", "tbl_Audit",
"[IDAudit] = " & Me.txtIDAudit),0) + 1
To use the combo to look up an audit record, use the combo's After Update
event:
With Me.RecordsetClone
.FindFirst "[IDAudit] = " & Me.cboAudit.Column(0) & " And "
[AuditVersion] = " & Me.cboAudit.Column(1)
If Not .NoMatch Then
Me.Bookmark = .Bookmark
End If
End With
--
Dave Hargis, Microsoft Access MVP
"Damian S" wrote:
Hi jer99,.
You need to have your combo bound to the Audit_Set field, and have the data
source for the combo update after you have selected the company the Audit is
for, eg: select * from tbl_Audit where companyID = me.lngCompanyID
or something similar.
Hope this helps.
Damian.
"jer99 via AccessMonster.com" wrote:
I have a table of audits.
An audit is related to many comments. The audit has an unique IDAudit, a name,
a date range and a client among other fields.
Since an audit can be redone and I wish to keep the details of each "re-do",
I just add a new record (IDAudit is autonumber) for the same date range and
client.
I wanted to record which audit record was the original for a specific client
and date range. So I had this brainstorm to add a field called "Audit_Set".
The Audit_Set would equal the ID_Audit of the original.
Cool.
Now I have my Audit entry form and I give a new audit a name. I would like to
have a CBO box that shows what the original audit was and if it is empty,
allow me to select one from a list of all audits for the particular client.
I've given myself a headache. I cant seem to figure out if I need to do
something in VBA after the update of the audit name, or if I need to do
something in the CBO. I'm assuming that the CBO should be left unbound.
Any help would be greatly appreciated!!!
--
Message posted via http://www.accessmonster.com
- References:
- CBO Selection utilizing the same table
- From: jer99 via AccessMonster.com
- CBO Selection utilizing the same table
- Prev by Date: everything is slow!
- Next by Date: RE: Link 2 Subforms in 1 to many
- Previous by thread: CBO Selection utilizing the same table
- Next by thread: Re: Conditional Query for Combo Box
- Index(es):
Relevant Pages
|