Jade5 said:
			
		
	
	
		
		
			If I amend the SQL statement to include Corporation ID and I create a combo
box with three fields - Company name, Company ID and Corporation ID how can I
use it to open a record based on the name the user types or selects. For
example, I use a combo box with Company ID and Corporation ID to open the
record using the following code. 
If Not IsNull(Me.Combo7) Then
		
		
	 
That's fine, you only want to proceed if they have selected an entry in
Combo7. A comment in passing: it's best to give each control a
meaningful name; eg. cboCorporations, or somesuch. Meaningfull names
are much easier to understand, in the code, compared to Combo7 etc.
	
	
		
		
			strWhere = "[Corporation ID] = """ & Me.Combo7.Column(1) & """"
		
		
	 
Ok, you've built a where condition like:  [CorporationID]="abc"
	
	
		
		
			DoCmd.OpenForm "Main form", WhereCondition:=strWhere
		
		
	 
You've opened the form, using that where condition. Does that work?
Does it position form "Main form" to the record with the selected
corporation ID? Is that what you mean that statement to do?
	
	
		
		
			strWhere = "[Company ID] = """ & Me.Combo7 & """"
		
		
	 
Ok, you've set up another condition. But I'm curious why the same value
(the selected value in Combo7) could be a Corporation ID in one table,
and a Company ID in another. Is that correct? Any reason why you did
not use the same field name in both tables?
	
	
		
		
			With Forms("Main form")![Company].Form
		
		
	 
That would get a reference to the form within the subform *control*
named "Company", in form "Main form". Yes? Again, a better naming
convention would help you out here. use an "sf" prefix for subforms.
Eg. sfCompany is a subform control related to companies.
	
	
		
		
			Set rs = .RecordsetClone
rs.FindFirst strWhere
Me.Combo7 = Null
.Bookmark = rs.Bookmark
		
		
	 
That should posiion that subform, to the first record where [Company
ID] = the value that you selected in Combo7. Is that what you meant? If
so, does it work?
So I'm not quite sure which parts are working, & which are not. Hlp me
out there.
I'll have to go for the rest of the day. So I won't see your answers
until late tonight, or tomorrow.
Cheers,
TC (MVP Access)
http://tc2.atspace.com