Opening Form from Record Selector

  • Thread starter Thread starter Michelle
  • Start date Start date
M

Michelle

I have a tabular form (PriContactInfo) I created that has
the basic client info in it. I click on a toggle button
corresponding the the first letter of the last name and
the clients that match the toggle button come up.

Now I want to be able to click on the record selector on
the left side, double click on it, and have it open up to
another form (ContactPersInfo) I created and match the
client info to the one that was selected.

Any help would be great!

Thanks!
Michelle
 
Michelle said:
I have a tabular form (PriContactInfo) I created that has
the basic client info in it. I click on a toggle button
corresponding the the first letter of the last name and
the clients that match the toggle button come up.

Now I want to be able to click on the record selector on
the left side, double click on it, and have it open up to
another form (ContactPersInfo) I created and match the
client info to the one that was selected.


Clicking on the record selector will trigger the Form's
click events where you can place the code to open the other
form.
 
I have a tabular form (PriContactInfo) I created that has
the basic client info in it. I click on a toggle button
corresponding the the first letter of the last name and
the clients that match the toggle button come up.

Now I want to be able to click on the record selector on
the left side, double click on it, and have it open up to
another form (ContactPersInfo) I created and match the
client info to the one that was selected.

Any help would be great!

Thanks!
Michelle

Why are you creating twice as much work for your self?
Add a Combo box that displays the ClientID and Name of each client
Ordered by Client Name, to the PriContactInfo form header.

Set the Combo Bound column to 1
Set it's Column count to 2
Set it's Column Widths to 0";1"
Set it's AutoExpand property to Yes.

You can then code the Combo Box's AfterUpdate event:

DoCmd.OpenForm "FormName", , , "[ClientID] = " & Me![ComboName]

You are just using one control to find the client and open the other
form.
If the Company name was'Brooks and Sons', start by typing a B, then an
R, etc. and the combo will advance to the first client that starts
with those letters. If no other client started with B or BR then
Brooks will show immediately, etc.
Select the name and the other form will open to that client's records.
 
Michelle said:
I have a tabular form (PriContactInfo) I created that has
the basic client info in it. I click on a toggle button
corresponding the the first letter of the last name and
the clients that match the toggle button come up.

Now I want to be able to click on the record selector on
the left side, double click on it, and have it open up to
another form (ContactPersInfo) I created and match the
client info to the one that was selected.

Any help would be great!

Thanks!
Michelle

I used the record selector to open an edit form, also. Works great.

Here is the code I used :

' current form name is frmGC1ListPermits
' form to be opened is frmGC1PermitEdit

Private Sub Form_DblClick(Cancel As Integer)
On Error GoTo Err_Form_DblClick

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmGC1PermitEdit"
stLinkCriteria = "[lngPermitID]=" & Me![Text32]

DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Form_DblClick:
Exit Sub

Err_Form_DblClick:
'MsgBox Err.Description
Resume Exit_Form_DblClick
End Sub


Me![Text32] is a hidden control that has the primary Key (linking field) for the
record to be selected in the record source of the form that will be opened.

HTH
 
Steve:

Thanks for the code, that's exactly what I am looking for but I'm having a
problem with the Text32. What do I replace it with in my dbase?

Thanks!

Michelle

SteveS said:
Michelle said:
I have a tabular form (PriContactInfo) I created that has
the basic client info in it. I click on a toggle button
corresponding the the first letter of the last name and
the clients that match the toggle button come up.

Now I want to be able to click on the record selector on
the left side, double click on it, and have it open up to
another form (ContactPersInfo) I created and match the
client info to the one that was selected.

Any help would be great!

Thanks!
Michelle

I used the record selector to open an edit form, also. Works great.

Here is the code I used :

' current form name is frmGC1ListPermits
' form to be opened is frmGC1PermitEdit

Private Sub Form_DblClick(Cancel As Integer)
On Error GoTo Err_Form_DblClick

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmGC1PermitEdit"
stLinkCriteria = "[lngPermitID]=" & Me![Text32]

DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Form_DblClick:
Exit Sub

Err_Form_DblClick:
'MsgBox Err.Description
Resume Exit_Form_DblClick
End Sub


Me![Text32] is a hidden control that has the primary Key (linking field) for the
record to be selected in the record source of the form that will be opened.

HTH
 
Every record in the table should be uniquely identified, ie the primary key. My
form is in continuous form view (to use the record selectors), but since the
primary key is an autonumber, I don't display it in the form, but it needs to be
on the form to be used in the criteria in (the Where clause) the DoCmd.OpenForm.
I hid it because it is not meaningful data (at least it shouldn't be!).

So I added a text box and set the control source to the primary key. You can
name the text box anything (OK, I admit it - I was too lazy to rename it), maybe
[CurrentRecordSelected] would be better than [Text32].

If I didn't explain it right, let me know....

HTH
--
Steve
--------------------------------
"Veni, Vidi, Velcro"
(I came, I saw, I stuck around.)

Steve:

Thanks for the code, that's exactly what I am looking for but I'm having a
problem with the Text32. What do I replace it with in my dbase?

Thanks!

Michelle

:

Michelle wrote:

I have a tabular form (PriContactInfo) I created that has
the basic client info in it. I click on a toggle button
corresponding the the first letter of the last name and
the clients that match the toggle button come up.

Now I want to be able to click on the record selector on
the left side, double click on it, and have it open up to
another form (ContactPersInfo) I created and match the
client info to the one that was selected.

Any help would be great!

Thanks!
Michelle

I used the record selector to open an edit form, also. Works great.

Here is the code I used :

' current form name is frmGC1ListPermits
' form to be opened is frmGC1PermitEdit

Private Sub Form_DblClick(Cancel As Integer)
On Error GoTo Err_Form_DblClick

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmGC1PermitEdit"
stLinkCriteria = "[lngPermitID]=" & Me![Text32]

DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Form_DblClick:
Exit Sub

Err_Form_DblClick:
'MsgBox Err.Description
Resume Exit_Form_DblClick
End Sub


Me![Text32] is a hidden control that has the primary Key (linking field) for the
record to be selected in the record source of the form that will be opened.

HTH
 
I'm still having a problem with this. I created the text box on the form
that is supposed to open with the control source as the ID (primary key) and
it's still not working. I'm getting an error message telling me that it
can't find the text box I'm referring to in the code.

Michelle

SteveS said:
Every record in the table should be uniquely identified, ie the primary key. My
form is in continuous form view (to use the record selectors), but since the
primary key is an autonumber, I don't display it in the form, but it needs to be
on the form to be used in the criteria in (the Where clause) the DoCmd.OpenForm.
I hid it because it is not meaningful data (at least it shouldn't be!).

So I added a text box and set the control source to the primary key. You can
name the text box anything (OK, I admit it - I was too lazy to rename it), maybe
[CurrentRecordSelected] would be better than [Text32].

If I didn't explain it right, let me know....

HTH
--
Steve
--------------------------------
"Veni, Vidi, Velcro"
(I came, I saw, I stuck around.)

Steve:

Thanks for the code, that's exactly what I am looking for but I'm having a
problem with the Text32. What do I replace it with in my dbase?

Thanks!

Michelle

:

Michelle wrote:


I have a tabular form (PriContactInfo) I created that has
the basic client info in it. I click on a toggle button
corresponding the the first letter of the last name and
the clients that match the toggle button come up.

Now I want to be able to click on the record selector on
the left side, double click on it, and have it open up to
another form (ContactPersInfo) I created and match the
client info to the one that was selected.

Any help would be great!

Thanks!
Michelle

I used the record selector to open an edit form, also. Works great.

Here is the code I used :

' current form name is frmGC1ListPermits
' form to be opened is frmGC1PermitEdit

Private Sub Form_DblClick(Cancel As Integer)
On Error GoTo Err_Form_DblClick

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmGC1PermitEdit"
stLinkCriteria = "[lngPermitID]=" & Me![Text32]

DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Form_DblClick:
Exit Sub

Err_Form_DblClick:
'MsgBox Err.Description
Resume Exit_Form_DblClick
End Sub


Me![Text32] is a hidden control that has the primary Key (linking field) for the
record to be selected in the record source of the form that will be opened.

HTH
 
Just to make sure I understand the problem, you created a hidden text box
control with the control source set to 'ID' (the PK) in the detail section of
form 'PriContactInfo'?

The code in the FORM OnClick event refers to the name of the hidden text
box, which should be different than the field name (control source).

The form 'ContactPersInfo' does not need the hidden text box (and shouldn't
be visible if it is an autonumber type).

If this is what you have, I could look at the database if you want. Delete
all records, compact it and WinZip it. sent it to me at sanfu at techie
dot com. Replace the 'and' & 'dot' with the correct symbols and remove the
spaces.


Steve
--------------------------------
"Veni, Vidi, Velcro"
(I came, I saw, I stuck around.)




Michelle said:
I'm still having a problem with this. I created the text box on the form
that is supposed to open with the control source as the ID (primary key) and
it's still not working. I'm getting an error message telling me that it
can't find the text box I'm referring to in the code.

Michelle

SteveS said:
Every record in the table should be uniquely identified, ie the primary key. My
form is in continuous form view (to use the record selectors), but since the
primary key is an autonumber, I don't display it in the form, but it needs to be
on the form to be used in the criteria in (the Where clause) the DoCmd.OpenForm.
I hid it because it is not meaningful data (at least it shouldn't be!).

So I added a text box and set the control source to the primary key. You can
name the text box anything (OK, I admit it - I was too lazy to rename it), maybe
[CurrentRecordSelected] would be better than [Text32].

If I didn't explain it right, let me know....

HTH
--
Steve
--------------------------------
"Veni, Vidi, Velcro"
(I came, I saw, I stuck around.)

Steve:

Thanks for the code, that's exactly what I am looking for but I'm having a
problem with the Text32. What do I replace it with in my dbase?

Thanks!

Michelle

:


Michelle wrote:


I have a tabular form (PriContactInfo) I created that has
the basic client info in it. I click on a toggle button
corresponding the the first letter of the last name and
the clients that match the toggle button come up.

Now I want to be able to click on the record selector on
the left side, double click on it, and have it open up to
another form (ContactPersInfo) I created and match the
client info to the one that was selected.

Any help would be great!

Thanks!
Michelle

I used the record selector to open an edit form, also. Works great.

Here is the code I used :

' current form name is frmGC1ListPermits
' form to be opened is frmGC1PermitEdit

Private Sub Form_DblClick(Cancel As Integer)
On Error GoTo Err_Form_DblClick

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmGC1PermitEdit"
stLinkCriteria = "[lngPermitID]=" & Me![Text32]

DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Form_DblClick:
Exit Sub

Err_Form_DblClick:
'MsgBox Err.Description
Resume Exit_Form_DblClick
End Sub


Me![Text32] is a hidden control that has the primary Key (linking field) for the
record to be selected in the record source of the form that will be opened.

HTH
 
Back
Top