A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Goto Related record



 
 
Thread Tools Display Modes
  #1  
Old May 14th, 2008, 04:22 PM posted to microsoft.public.access.forms
IKMD66
external usenet poster
 
Posts: 19
Default Goto Related record

Hi,

I am new to forms and macro's etc so apologies in advance if there is a
simple solution to this.

I have a basic requirement where a form shows a related record number e.g.
a students record displays the ID of a related student - in my case this
refers to the primary record where aditional details are stored - address,
parents / guardians etc. I want to place a button on a form that will allow
the user to click the button to jump to the related record.

Any assistance would be greatly appreciated.

Thanks in advance.
Kirk
  #2  
Old May 14th, 2008, 04:30 PM posted to microsoft.public.access.forms
Golfinray
external usenet poster
 
Posts: 1,597
Default Goto Related record

A command button might work for you. Use the command button wizard for goto
record. If not you can use a combo box for a filter to find records. Use the
combo box wizard to create the combo and let it use the field name for your
lookup. Then right click on the combo, go to properties and then events. In
the afterupdate event start the code builder and type:
Me.filter = "[yourfieldname] = """ & Me.combo# & """"
Me.filteron=true

"IKMD66" wrote:

Hi,

I am new to forms and macro's etc so apologies in advance if there is a
simple solution to this.

I have a basic requirement where a form shows a related record number e.g.
a students record displays the ID of a related student - in my case this
refers to the primary record where aditional details are stored - address,
parents / guardians etc. I want to place a button on a form that will allow
the user to click the button to jump to the related record.

Any assistance would be greatly appreciated.

Thanks in advance.
Kirk

  #3  
Old May 14th, 2008, 05:46 PM posted to microsoft.public.access.forms
IKMD66
external usenet poster
 
Posts: 19
Default Goto Related record

Hi,

Thanks for your reply. I already have a go to (combo box) on the header of
the form - where the user can select the record and the form jumps to the
record. The issue I am trying to solve is - within a record there may already
be maintained a related record number I require a button to be placed beside
the related record number field that will allow the user simply to press the
button and jump to the related record (without having to type anything).

Further assistance is appreciiated.

Regards,
Kirk

"Golfinray" wrote:

A command button might work for you. Use the command button wizard for goto
record. If not you can use a combo box for a filter to find records. Use the
combo box wizard to create the combo and let it use the field name for your
lookup. Then right click on the combo, go to properties and then events. In
the afterupdate event start the code builder and type:
Me.filter = "[yourfieldname] = """ & Me.combo# & """"
Me.filteron=true

"IKMD66" wrote:

Hi,

I am new to forms and macro's etc so apologies in advance if there is a
simple solution to this.

I have a basic requirement where a form shows a related record number e.g.
a students record displays the ID of a related student - in my case this
refers to the primary record where aditional details are stored - address,
parents / guardians etc. I want to place a button on a form that will allow
the user to click the button to jump to the related record.

Any assistance would be greatly appreciated.

Thanks in advance.
Kirk

  #4  
Old May 14th, 2008, 06:11 PM posted to microsoft.public.access.forms
Beetle
external usenet poster
 
Posts: 1,254
Default Goto Related record

When you say "jump to the related record" do you mean you're trying to
open another form to show additional info for that record ID? If so, you
can use the OpenArgs property of the OpenForm method.

In the On Click event of your command button in the first form put code like;

DoCmd.OpenForm "YourOtherForm", , , , , , "[RecordID]=" & Me.RecordID

(make sure to use the correct number of commas)

Then in the Open event of your other form you would put:

If Not IsNull (Me.OpenArgs) Then
Me.Filter = Me.OpenArgs
Me.FilterOn = True
End If
--
_________

Sean Bailey


"IKMD66" wrote:

Hi,

Thanks for your reply. I already have a go to (combo box) on the header of
the form - where the user can select the record and the form jumps to the
record. The issue I am trying to solve is - within a record there may already
be maintained a related record number I require a button to be placed beside
the related record number field that will allow the user simply to press the
button and jump to the related record (without having to type anything).

Further assistance is appreciiated.

Regards,
Kirk

"Golfinray" wrote:

A command button might work for you. Use the command button wizard for goto
record. If not you can use a combo box for a filter to find records. Use the
combo box wizard to create the combo and let it use the field name for your
lookup. Then right click on the combo, go to properties and then events. In
the afterupdate event start the code builder and type:
Me.filter = "[yourfieldname] = """ & Me.combo# & """"
Me.filteron=true

"IKMD66" wrote:

Hi,

I am new to forms and macro's etc so apologies in advance if there is a
simple solution to this.

I have a basic requirement where a form shows a related record number e.g.
a students record displays the ID of a related student - in my case this
refers to the primary record where aditional details are stored - address,
parents / guardians etc. I want to place a button on a form that will allow
the user to click the button to jump to the related record.

Any assistance would be greatly appreciated.

Thanks in advance.
Kirk

  #5  
Old May 14th, 2008, 06:47 PM posted to microsoft.public.access.forms
IKMD66
external usenet poster
 
Posts: 19
Default Goto Related record

Hi,

Thansk foryour response.

Yes I do mean that it should open the (same) form but for the related
record. I will try what you suggest.

Regards,
Kirk

"Beetle" wrote:

When you say "jump to the related record" do you mean you're trying to
open another form to show additional info for that record ID? If so, you
can use the OpenArgs property of the OpenForm method.

In the On Click event of your command button in the first form put code like;

DoCmd.OpenForm "YourOtherForm", , , , , , "[RecordID]=" & Me.RecordID

(make sure to use the correct number of commas)

Then in the Open event of your other form you would put:

If Not IsNull (Me.OpenArgs) Then
Me.Filter = Me.OpenArgs
Me.FilterOn = True
End If
--
_________

Sean Bailey


"IKMD66" wrote:

Hi,

Thanks for your reply. I already have a go to (combo box) on the header of
the form - where the user can select the record and the form jumps to the
record. The issue I am trying to solve is - within a record there may already
be maintained a related record number I require a button to be placed beside
the related record number field that will allow the user simply to press the
button and jump to the related record (without having to type anything).

Further assistance is appreciiated.

Regards,
Kirk

"Golfinray" wrote:

A command button might work for you. Use the command button wizard for goto
record. If not you can use a combo box for a filter to find records. Use the
combo box wizard to create the combo and let it use the field name for your
lookup. Then right click on the combo, go to properties and then events. In
the afterupdate event start the code builder and type:
Me.filter = "[yourfieldname] = """ & Me.combo# & """"
Me.filteron=true

"IKMD66" wrote:

Hi,

I am new to forms and macro's etc so apologies in advance if there is a
simple solution to this.

I have a basic requirement where a form shows a related record number e.g.
a students record displays the ID of a related student - in my case this
refers to the primary record where aditional details are stored - address,
parents / guardians etc. I want to place a button on a form that will allow
the user to click the button to jump to the related record.

Any assistance would be greatly appreciated.

Thanks in advance.
Kirk

  #6  
Old May 14th, 2008, 11:00 PM posted to microsoft.public.access.forms
Beetle
external usenet poster
 
Posts: 1,254
Default Goto Related record

The method I described is to open a differnet form based on some criteria.
However, I now suspect that you are just trying to move to a different
record on the same form, in which case my previous suggestion will not
work. If you are just trying to move to a different record on the same form,
then post back.
--
_________

Sean Bailey


"IKMD66" wrote:

Hi,

Thansk foryour response.

Yes I do mean that it should open the (same) form but for the related
record. I will try what you suggest.

Regards,
Kirk

"Beetle" wrote:

When you say "jump to the related record" do you mean you're trying to
open another form to show additional info for that record ID? If so, you
can use the OpenArgs property of the OpenForm method.

In the On Click event of your command button in the first form put code like;

DoCmd.OpenForm "YourOtherForm", , , , , , "[RecordID]=" & Me.RecordID

(make sure to use the correct number of commas)

Then in the Open event of your other form you would put:

If Not IsNull (Me.OpenArgs) Then
Me.Filter = Me.OpenArgs
Me.FilterOn = True
End If
--
_________

Sean Bailey


"IKMD66" wrote:

Hi,

Thanks for your reply. I already have a go to (combo box) on the header of
the form - where the user can select the record and the form jumps to the
record. The issue I am trying to solve is - within a record there may already
be maintained a related record number I require a button to be placed beside
the related record number field that will allow the user simply to press the
button and jump to the related record (without having to type anything).

Further assistance is appreciiated.

Regards,
Kirk

"Golfinray" wrote:

A command button might work for you. Use the command button wizard for goto
record. If not you can use a combo box for a filter to find records. Use the
combo box wizard to create the combo and let it use the field name for your
lookup. Then right click on the combo, go to properties and then events. In
the afterupdate event start the code builder and type:
Me.filter = "[yourfieldname] = """ & Me.combo# & """"
Me.filteron=true

"IKMD66" wrote:

Hi,

I am new to forms and macro's etc so apologies in advance if there is a
simple solution to this.

I have a basic requirement where a form shows a related record number e.g.
a students record displays the ID of a related student - in my case this
refers to the primary record where aditional details are stored - address,
parents / guardians etc. I want to place a button on a form that will allow
the user to click the button to jump to the related record.

Any assistance would be greatly appreciated.

Thanks in advance.
Kirk

  #7  
Old May 15th, 2008, 09:32 AM posted to microsoft.public.access.forms
IKMD66
external usenet poster
 
Posts: 19
Default Goto Related record

Hi Sean,

Yes I am just trying to move to a different record on the same form e.g when
I view client record 25, recorded within this record is the related client ID
10. I want to place a button beside this field that allows me to go to record
10.

Thanks again.

Regards,
Kirk

"Beetle" wrote:

The method I described is to open a differnet form based on some criteria.
However, I now suspect that you are just trying to move to a different
record on the same form, in which case my previous suggestion will not
work. If you are just trying to move to a different record on the same form,
then post back.
--
_________

Sean Bailey


"IKMD66" wrote:

Hi,

Thansk foryour response.

Yes I do mean that it should open the (same) form but for the related
record. I will try what you suggest.

Regards,
Kirk

"Beetle" wrote:

When you say "jump to the related record" do you mean you're trying to
open another form to show additional info for that record ID? If so, you
can use the OpenArgs property of the OpenForm method.

In the On Click event of your command button in the first form put code like;

DoCmd.OpenForm "YourOtherForm", , , , , , "[RecordID]=" & Me.RecordID

(make sure to use the correct number of commas)

Then in the Open event of your other form you would put:

If Not IsNull (Me.OpenArgs) Then
Me.Filter = Me.OpenArgs
Me.FilterOn = True
End If
--
_________

Sean Bailey


"IKMD66" wrote:

Hi,

Thanks for your reply. I already have a go to (combo box) on the header of
the form - where the user can select the record and the form jumps to the
record. The issue I am trying to solve is - within a record there may already
be maintained a related record number I require a button to be placed beside
the related record number field that will allow the user simply to press the
button and jump to the related record (without having to type anything).

Further assistance is appreciiated.

Regards,
Kirk

"Golfinray" wrote:

A command button might work for you. Use the command button wizard for goto
record. If not you can use a combo box for a filter to find records. Use the
combo box wizard to create the combo and let it use the field name for your
lookup. Then right click on the combo, go to properties and then events. In
the afterupdate event start the code builder and type:
Me.filter = "[yourfieldname] = """ & Me.combo# & """"
Me.filteron=true

"IKMD66" wrote:

Hi,

I am new to forms and macro's etc so apologies in advance if there is a
simple solution to this.

I have a basic requirement where a form shows a related record number e.g.
a students record displays the ID of a related student - in my case this
refers to the primary record where aditional details are stored - address,
parents / guardians etc. I want to place a button on a form that will allow
the user to click the button to jump to the related record.

Any assistance would be greatly appreciated.

Thanks in advance.
Kirk

  #8  
Old May 15th, 2008, 05:38 PM posted to microsoft.public.access.forms
Beetle
external usenet poster
 
Posts: 1,254
Default Goto Related record

OK, so let's suppose you have a field called ClientID that is the primary key
for each client, and another field called RelatedClient that holds the
ClientID
number for some other client, each with an associated text box control on
your form. All you should need is some code like this in the On Click event
of your button;

Private Sub cmdYourButton_Click()

With Me.RecordsetClone
.FindFirst "[ClientID]=" & Me![RelatedClient]
If Not .NoMatch Then
Me.Bookmark = .Bookmark
End If
End With

End Sub

The above code assumes that ClientID and RelatedClient are integer values.
If they are text, then you will need to add qoutes in the code.
--
_________

Sean Bailey


"IKMD66" wrote:

Hi Sean,

Yes I am just trying to move to a different record on the same form e.g when
I view client record 25, recorded within this record is the related client ID
10. I want to place a button beside this field that allows me to go to record
10.

Thanks again.

Regards,
Kirk

"Beetle" wrote:

The method I described is to open a differnet form based on some criteria.
However, I now suspect that you are just trying to move to a different
record on the same form, in which case my previous suggestion will not
work. If you are just trying to move to a different record on the same form,
then post back.
--
_________

Sean Bailey


"IKMD66" wrote:

Hi,

Thansk foryour response.

Yes I do mean that it should open the (same) form but for the related
record. I will try what you suggest.

Regards,
Kirk

"Beetle" wrote:

When you say "jump to the related record" do you mean you're trying to
open another form to show additional info for that record ID? If so, you
can use the OpenArgs property of the OpenForm method.

In the On Click event of your command button in the first form put code like;

DoCmd.OpenForm "YourOtherForm", , , , , , "[RecordID]=" & Me.RecordID

(make sure to use the correct number of commas)

Then in the Open event of your other form you would put:

If Not IsNull (Me.OpenArgs) Then
Me.Filter = Me.OpenArgs
Me.FilterOn = True
End If
--
_________

Sean Bailey


"IKMD66" wrote:

Hi,

Thanks for your reply. I already have a go to (combo box) on the header of
the form - where the user can select the record and the form jumps to the
record. The issue I am trying to solve is - within a record there may already
be maintained a related record number I require a button to be placed beside
the related record number field that will allow the user simply to press the
button and jump to the related record (without having to type anything).

Further assistance is appreciiated.

Regards,
Kirk

"Golfinray" wrote:

A command button might work for you. Use the command button wizard for goto
record. If not you can use a combo box for a filter to find records. Use the
combo box wizard to create the combo and let it use the field name for your
lookup. Then right click on the combo, go to properties and then events. In
the afterupdate event start the code builder and type:
Me.filter = "[yourfieldname] = """ & Me.combo# & """"
Me.filteron=true

"IKMD66" wrote:

Hi,

I am new to forms and macro's etc so apologies in advance if there is a
simple solution to this.

I have a basic requirement where a form shows a related record number e.g.
a students record displays the ID of a related student - in my case this
refers to the primary record where aditional details are stored - address,
parents / guardians etc. I want to place a button on a form that will allow
the user to click the button to jump to the related record.

Any assistance would be greatly appreciated.

Thanks in advance.
Kirk

  #9  
Old May 15th, 2008, 07:42 PM posted to microsoft.public.access.forms
IKMD66
external usenet poster
 
Posts: 19
Default Goto Related record

Sean - You're a star.

Many thanks for your assitance - your logic provides exactly what is required.

Best Regards,
Kirk

"Beetle" wrote:

OK, so let's suppose you have a field called ClientID that is the primary key
for each client, and another field called RelatedClient that holds the
ClientID
number for some other client, each with an associated text box control on
your form. All you should need is some code like this in the On Click event
of your button;

Private Sub cmdYourButton_Click()

With Me.RecordsetClone
.FindFirst "[ClientID]=" & Me![RelatedClient]
If Not .NoMatch Then
Me.Bookmark = .Bookmark
End If
End With

End Sub

The above code assumes that ClientID and RelatedClient are integer values.
If they are text, then you will need to add qoutes in the code.
--
_________

Sean Bailey


"IKMD66" wrote:

Hi Sean,

Yes I am just trying to move to a different record on the same form e.g when
I view client record 25, recorded within this record is the related client ID
10. I want to place a button beside this field that allows me to go to record
10.

Thanks again.

Regards,
Kirk

"Beetle" wrote:

The method I described is to open a differnet form based on some criteria.
However, I now suspect that you are just trying to move to a different
record on the same form, in which case my previous suggestion will not
work. If you are just trying to move to a different record on the same form,
then post back.
--
_________

Sean Bailey


"IKMD66" wrote:

Hi,

Thansk foryour response.

Yes I do mean that it should open the (same) form but for the related
record. I will try what you suggest.

Regards,
Kirk

"Beetle" wrote:

When you say "jump to the related record" do you mean you're trying to
open another form to show additional info for that record ID? If so, you
can use the OpenArgs property of the OpenForm method.

In the On Click event of your command button in the first form put code like;

DoCmd.OpenForm "YourOtherForm", , , , , , "[RecordID]=" & Me.RecordID

(make sure to use the correct number of commas)

Then in the Open event of your other form you would put:

If Not IsNull (Me.OpenArgs) Then
Me.Filter = Me.OpenArgs
Me.FilterOn = True
End If
--
_________

Sean Bailey


"IKMD66" wrote:

Hi,

Thanks for your reply. I already have a go to (combo box) on the header of
the form - where the user can select the record and the form jumps to the
record. The issue I am trying to solve is - within a record there may already
be maintained a related record number I require a button to be placed beside
the related record number field that will allow the user simply to press the
button and jump to the related record (without having to type anything).

Further assistance is appreciiated.

Regards,
Kirk

"Golfinray" wrote:

A command button might work for you. Use the command button wizard for goto
record. If not you can use a combo box for a filter to find records. Use the
combo box wizard to create the combo and let it use the field name for your
lookup. Then right click on the combo, go to properties and then events. In
the afterupdate event start the code builder and type:
Me.filter = "[yourfieldname] = """ & Me.combo# & """"
Me.filteron=true

"IKMD66" wrote:

Hi,

I am new to forms and macro's etc so apologies in advance if there is a
simple solution to this.

I have a basic requirement where a form shows a related record number e.g.
a students record displays the ID of a related student - in my case this
refers to the primary record where aditional details are stored - address,
parents / guardians etc. I want to place a button on a form that will allow
the user to click the button to jump to the related record.

Any assistance would be greatly appreciated.

Thanks in advance.
Kirk

  #10  
Old May 15th, 2008, 07:53 PM posted to microsoft.public.access.forms
IKMD66
external usenet poster
 
Posts: 19
Default Goto Related record

Sean,

If I may ask one more question. How do I prevent the runtime error "(3077)
syntax error (missing operator) in expression", if the button ie pressed when
no related record is maintained - in this case I do not want anything to
happen - simply, perhaps a message stating "Related Client not maintained."

I have detailed the programming below.

Private Sub GOTO_Click()
With Me.RecordsetClone
..FindFirst "[Client ID]=" & Me![Related (Primary) Client]
If Not .NoMatch Then
Me.Bookmark = .Bookmark
End If
End With
End Sub


Thanks again.
Kirk

"Beetle" wrote:

OK, so let's suppose you have a field called ClientID that is the primary key
for each client, and another field called RelatedClient that holds the
ClientID
number for some other client, each with an associated text box control on
your form. All you should need is some code like this in the On Click event
of your button;

Private Sub cmdYourButton_Click()

With Me.RecordsetClone
.FindFirst "[ClientID]=" & Me![RelatedClient]
If Not .NoMatch Then
Me.Bookmark = .Bookmark
End If
End With

End Sub

The above code assumes that ClientID and RelatedClient are integer values.
If they are text, then you will need to add qoutes in the code.
--
_________

Sean Bailey


"IKMD66" wrote:

Hi Sean,

Yes I am just trying to move to a different record on the same form e.g when
I view client record 25, recorded within this record is the related client ID
10. I want to place a button beside this field that allows me to go to record
10.

Thanks again.

Regards,
Kirk

"Beetle" wrote:

The method I described is to open a differnet form based on some criteria.
However, I now suspect that you are just trying to move to a different
record on the same form, in which case my previous suggestion will not
work. If you are just trying to move to a different record on the same form,
then post back.
--
_________

Sean Bailey


"IKMD66" wrote:

Hi,

Thansk foryour response.

Yes I do mean that it should open the (same) form but for the related
record. I will try what you suggest.

Regards,
Kirk

"Beetle" wrote:

When you say "jump to the related record" do you mean you're trying to
open another form to show additional info for that record ID? If so, you
can use the OpenArgs property of the OpenForm method.

In the On Click event of your command button in the first form put code like;

DoCmd.OpenForm "YourOtherForm", , , , , , "[RecordID]=" & Me.RecordID

(make sure to use the correct number of commas)

Then in the Open event of your other form you would put:

If Not IsNull (Me.OpenArgs) Then
Me.Filter = Me.OpenArgs
Me.FilterOn = True
End If
--
_________

Sean Bailey


"IKMD66" wrote:

Hi,

Thanks for your reply. I already have a go to (combo box) on the header of
the form - where the user can select the record and the form jumps to the
record. The issue I am trying to solve is - within a record there may already
be maintained a related record number I require a button to be placed beside
the related record number field that will allow the user simply to press the
button and jump to the related record (without having to type anything).

Further assistance is appreciiated.

Regards,
Kirk

"Golfinray" wrote:

A command button might work for you. Use the command button wizard for goto
record. If not you can use a combo box for a filter to find records. Use the
combo box wizard to create the combo and let it use the field name for your
lookup. Then right click on the combo, go to properties and then events. In
the afterupdate event start the code builder and type:
Me.filter = "[yourfieldname] = """ & Me.combo# & """"
Me.filteron=true

"IKMD66" wrote:

Hi,

I am new to forms and macro's etc so apologies in advance if there is a
simple solution to this.

I have a basic requirement where a form shows a related record number e.g.
a students record displays the ID of a related student - in my case this
refers to the primary record where aditional details are stored - address,
parents / guardians etc. I want to place a button on a form that will allow
the user to click the button to jump to the related record.

Any assistance would be greatly appreciated.

Thanks in advance.
Kirk

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:25 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.