If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Unanswered: Click to open a specific record

This is the code that I use to double click on text box displaying certain data that calls the function that will go to a particular form/screen and open it displaying data relevant for that record

Private Sub Text40_DblClick(Cancel As Integer)

Dim ctl As Control
Dim frm As Form

Set frm = Forms!frmSearchFileRegister
Set ctl = frm!Text40

Call OpenEdit_ARegisterEntry(ctl.Text)

End Sub

But in stead of doing this I have a command button and would like to do the same thing by clicking on the button,it opens the relevant form with relevant data,but when I do that this is the error message I get and highlights the line of code

error: object doesn't support this property or method
Call OpenEdit_ARegisterEntry(ctl.Text)

which property do I need to assign to my control(that being a command button) in order for this to work, anybody.

Re: Click to open a specific record

This is the code that I use to double click on text box displaying certain data that calls the function that will go to a particular form/screen and open it displaying data relevant for that record

Private Sub Text40_DblClick(Cancel As Integer)

Dim ctl As Control
Dim frm As Form

Set frm = Forms!frmSearchFileRegister
Set ctl = frm!Text40

Call OpenEdit_ARegisterEntry(ctl.Text)

End Sub

But in stead of doing this I have a command button and would like to do the same thing by clicking on the button,it opens the relevant form with relevant data,but when I do that this is the error message I get and highlights the line of code

error: object doesn't support this property or method
Call OpenEdit_ARegisterEntry(ctl.Text)

which property do I need to assign to my control(that being a command button) in order for this to work, anybody.

Thanks for your help once again but it is saying I have to set the focus on the control before doing anything with it and I try using "GoToConrol" or "SetFocus" but just keep getting invalid property assign errors.

does this get you there?

I've done this before by first setting up the form I want to open to a specific record with the code that moves the form to a specific record using a combobox (access will make this for you) something like:

Sub cboRecordID_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object