Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

referencing

Status
Not open for further replies.

axism

MIS
May 17, 2005
58
Hi, I have form a and form b. Within form a, i have a combo box, drop down. I want to change form b's recordsource base on update on drop drown on form a. so i had the follow in after update event for drop down combo box. However, I am getting compiling error when running. please help.

Code as follows on form a's drop down after update event:
Code:
Private Sub cmboNames_AfterUpdate()

Forms!b.RecordSource = "SELECT dbo.qryContactTypesDetails.ContactID, dbo.qryContactTypesDetails.ContactType FROM dbo.qryContactTypesDetails WHERE dbo.qryContactTypesDetails.ContactID = " & currentid

Forms!sfrmContactType.Requery
    
End Sub

 
What is the name of the 2nd form, b or sfrmContactType ?
Is it a mainform or a subform ?
I am getting compiling error
any chance you could post the error message and the highlighted line when in debug mode ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
form a is trying to change recordsource for form b. that sfrmcontacttype shouldnt be there.
 
now is a run time error.

Run-time error '2450':
Microsoft Access can't find the form 'b' referred to in a macaro expression or Visual Basic code.
 
I fixed using the full name of the form.
 
Seems that b is not an open mainform.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
syntax should be Forms!a!b.Recordsource
Forms!MasterForm!SubForm.Recordsource
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top