Bookmark

G

Guest

Hi...hoping for some guidance.

Two forms: [MainForm], [PopUpForm], each bound to different table.
Button on [MainForm] calls [PopUpForm].
Button on [PopUpForm] closes [PopUpForm] and focus goes back to [MainForm].

When [MainForm] gets focus again, the first record is displayed. I know what
causes this; I don't wish to change that situation -- but I would like to
return to the record I left. I successfully use the following code several
places, however, its always only ONE form, such as [MainForm]. In this case I
have two forms; one called ([PopUpForm]) and one "underlying" ([MainForm]).
Thus, I think the code belongs in the called form ([PopUpForm]) but I don't
know how to modify it.

Code:
Dim strClientID as String
strClientID=Me!ClientID
Me.Requery
With Me.RecordsetClone
.FindFirst "ClientID=""" & strClientID & """"
If .NoMatch = False Then
Me.Bookmark = .Bookmark
Else
.Bookmark=Me.Bookmark
End If
End With

ClientID is a control on each form.

Can anyone be of assistance?
 
P

PC Datasheet

Put the following code in the Click event of the button on your main form:
Dim strClientID as String
strClientID=Me!ClientID
DoCmd.OpenForm "NameOfPopUpForm",,,,,acDialog
Me.Requery
With Me.RecordsetClone
.FindFirst "ClientID=""" & strClientID & """"
If .NoMatch = False Then
Me.Bookmark = .Bookmark
Else
.Bookmark=Me.Bookmark
End If
End With
 
G

Guest

PC, thanks for responding.

I tried that...but doesn't work.

I need the [MainForm] to return to the record being viewed when [PopUpForm]
is called, but not until closing [PopUpForm] -- said closing routine needs a
requery of [MainForm].

Wouldn't the code be in the closing routine for [PopUpForm]? How would it
be done? All the variations I try fail. Keep in mind, please, I am a rank
amateur.

--
Thanks for your help,
Chris


PC Datasheet said:
Put the following code in the Click event of the button on your main form:
Dim strClientID as String
strClientID=Me!ClientID
DoCmd.OpenForm "NameOfPopUpForm",,,,,acDialog
Me.Requery
With Me.RecordsetClone
.FindFirst "ClientID=""" & strClientID & """"
If .NoMatch = False Then
Me.Bookmark = .Bookmark
Else
.Bookmark=Me.Bookmark
End If
End With


--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com




Chris said:
Hi...hoping for some guidance.

Two forms: [MainForm], [PopUpForm], each bound to different table.
Button on [MainForm] calls [PopUpForm].
Button on [PopUpForm] closes [PopUpForm] and focus goes back to
[MainForm].

When [MainForm] gets focus again, the first record is displayed. I know
what
causes this; I don't wish to change that situation -- but I would like to
return to the record I left. I successfully use the following code
several
places, however, its always only ONE form, such as [MainForm]. In this
case I
have two forms; one called ([PopUpForm]) and one "underlying"
([MainForm]).
Thus, I think the code belongs in the called form ([PopUpForm]) but I
don't
know how to modify it.

Code:
Dim strClientID as String
strClientID=Me!ClientID
Me.Requery
With Me.RecordsetClone
.FindFirst "ClientID=""" & strClientID & """"
If .NoMatch = False Then
Me.Bookmark = .Bookmark
Else
.Bookmark=Me.Bookmark
End If
End With

ClientID is a control on each form.

Can anyone be of assistance?
 
P

PC Datasheet

Is ClientID the primary key of your Main Form?

Is ClientID a number or string?

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com


Chris said:
PC, thanks for responding.

I tried that...but doesn't work.

I need the [MainForm] to return to the record being viewed when
[PopUpForm]
is called, but not until closing [PopUpForm] -- said closing routine needs
a
requery of [MainForm].

Wouldn't the code be in the closing routine for [PopUpForm]? How would it
be done? All the variations I try fail. Keep in mind, please, I am a
rank
amateur.

--
Thanks for your help,
Chris


PC Datasheet said:
Put the following code in the Click event of the button on your main
form:
Dim strClientID as String
strClientID=Me!ClientID
DoCmd.OpenForm "NameOfPopUpForm",,,,,acDialog
Me.Requery
With Me.RecordsetClone
.FindFirst "ClientID=""" & strClientID & """"
If .NoMatch = False Then
Me.Bookmark = .Bookmark
Else
.Bookmark=Me.Bookmark
End If
End With


--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com




Chris said:
Hi...hoping for some guidance.

Two forms: [MainForm], [PopUpForm], each bound to different table.
Button on [MainForm] calls [PopUpForm].
Button on [PopUpForm] closes [PopUpForm] and focus goes back to
[MainForm].

When [MainForm] gets focus again, the first record is displayed. I know
what
causes this; I don't wish to change that situation -- but I would like
to
return to the record I left. I successfully use the following code
several
places, however, its always only ONE form, such as [MainForm]. In this
case I
have two forms; one called ([PopUpForm]) and one "underlying"
([MainForm]).
Thus, I think the code belongs in the called form ([PopUpForm]) but I
don't
know how to modify it.

Code:
Dim strClientID as String
strClientID=Me!ClientID
Me.Requery
With Me.RecordsetClone
.FindFirst "ClientID=""" & strClientID & """"
If .NoMatch = False Then
Me.Bookmark = .Bookmark
Else
.Bookmark=Me.Bookmark
End If
End With

ClientID is a control on each form.

Can anyone be of assistance?
 
G

Guest

ClientID is a text field and primary key for [table1] -- [MainForm].

also

ClientID is a text field and primary key for [table2] -- [PopUpForm].

Each of those forms has a control [ClientID] whose recordsource is the
respective table.

--
Thanks for your help,
Chris


PC Datasheet said:
Is ClientID the primary key of your Main Form?

Is ClientID a number or string?

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com


Chris said:
PC, thanks for responding.

I tried that...but doesn't work.

I need the [MainForm] to return to the record being viewed when
[PopUpForm]
is called, but not until closing [PopUpForm] -- said closing routine needs
a
requery of [MainForm].

Wouldn't the code be in the closing routine for [PopUpForm]? How would it
be done? All the variations I try fail. Keep in mind, please, I am a
rank
amateur.

--
Thanks for your help,
Chris


PC Datasheet said:
Put the following code in the Click event of the button on your main
form:
Dim strClientID as String
strClientID=Me!ClientID
DoCmd.OpenForm "NameOfPopUpForm",,,,,acDialog
Me.Requery
With Me.RecordsetClone
.FindFirst "ClientID=""" & strClientID & """"
If .NoMatch = False Then
Me.Bookmark = .Bookmark
Else
.Bookmark=Me.Bookmark
End If
End With


--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com




Hi...hoping for some guidance.

Two forms: [MainForm], [PopUpForm], each bound to different table.
Button on [MainForm] calls [PopUpForm].
Button on [PopUpForm] closes [PopUpForm] and focus goes back to
[MainForm].

When [MainForm] gets focus again, the first record is displayed. I know
what
causes this; I don't wish to change that situation -- but I would like
to
return to the record I left. I successfully use the following code
several
places, however, its always only ONE form, such as [MainForm]. In this
case I
have two forms; one called ([PopUpForm]) and one "underlying"
([MainForm]).
Thus, I think the code belongs in the called form ([PopUpForm]) but I
don't
know how to modify it.

Code:
Dim strClientID as String
strClientID=Me!ClientID
Me.Requery
With Me.RecordsetClone
.FindFirst "ClientID=""" & strClientID & """"
If .NoMatch = False Then
Me.Bookmark = .Bookmark
Else
.Bookmark=Me.Bookmark
End If
End With

ClientID is a control on each form.

Can anyone be of assistance?
 
P

PC Datasheet

Try this version of my previous code:
Dim Rst As DAO.RecordsetClone
Dim strClientID as String
strClientID=Me!ClientID
DoCmd.OpenForm "NameOfPopUpForm",,,,,acDialog
Me.Requery
Set Rst = Me.RecordsetClone
With Rst
.FindFirst "ClientID=""" & strClientID & """"
Me.Bookmark = .Bookmark
.Close
Set Rst = Nothing
End With

If it doesn't work this time, post your code in the Click event of the
button.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com



PC Datasheet said:
Put the following code in the Click event of the button on your main form:
Dim strClientID as String
strClientID=Me!ClientID
DoCmd.OpenForm "NameOfPopUpForm",,,,,acDialog
Me.Requery
With Me.RecordsetClone
.FindFirst "ClientID=""" & strClientID & """"
If .NoMatch = False Then
Me.Bookmark = .Bookmark
Else
.Bookmark=Me.Bookmark
End If
End With


--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com




Chris said:
Hi...hoping for some guidance.

Two forms: [MainForm], [PopUpForm], each bound to different table.
Button on [MainForm] calls [PopUpForm].
Button on [PopUpForm] closes [PopUpForm] and focus goes back to
[MainForm].

When [MainForm] gets focus again, the first record is displayed. I know
what
causes this; I don't wish to change that situation -- but I would like to
return to the record I left. I successfully use the following code
several
places, however, its always only ONE form, such as [MainForm]. In this
case I
have two forms; one called ([PopUpForm]) and one "underlying"
([MainForm]).
Thus, I think the code belongs in the called form ([PopUpForm]) but I
don't
know how to modify it.

Code:
Dim strClientID as String
strClientID=Me!ClientID
Me.Requery
With Me.RecordsetClone
.FindFirst "ClientID=""" & strClientID & """"
If .NoMatch = False Then
Me.Bookmark = .Bookmark
Else
.Bookmark=Me.Bookmark
End If
End With

ClientID is a control on each form.

Can anyone be of assistance?
 
G

Guest

Fails compile with "Rst As DAO.RecordsetClone" highlited and returns the
error message "User defined type not defined."


--
Thanks for your help,
Chris


PC Datasheet said:
Try this version of my previous code:
Dim Rst As DAO.RecordsetClone
Dim strClientID as String
strClientID=Me!ClientID
DoCmd.OpenForm "NameOfPopUpForm",,,,,acDialog
Me.Requery
Set Rst = Me.RecordsetClone
With Rst
.FindFirst "ClientID=""" & strClientID & """"
Me.Bookmark = .Bookmark
.Close
Set Rst = Nothing
End With

If it doesn't work this time, post your code in the Click event of the
button.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com



PC Datasheet said:
Put the following code in the Click event of the button on your main form:
Dim strClientID as String
strClientID=Me!ClientID
DoCmd.OpenForm "NameOfPopUpForm",,,,,acDialog
Me.Requery
With Me.RecordsetClone
.FindFirst "ClientID=""" & strClientID & """"
If .NoMatch = False Then
Me.Bookmark = .Bookmark
Else
.Bookmark=Me.Bookmark
End If
End With


--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com




Chris said:
Hi...hoping for some guidance.

Two forms: [MainForm], [PopUpForm], each bound to different table.
Button on [MainForm] calls [PopUpForm].
Button on [PopUpForm] closes [PopUpForm] and focus goes back to
[MainForm].

When [MainForm] gets focus again, the first record is displayed. I know
what
causes this; I don't wish to change that situation -- but I would like to
return to the record I left. I successfully use the following code
several
places, however, its always only ONE form, such as [MainForm]. In this
case I
have two forms; one called ([PopUpForm]) and one "underlying"
([MainForm]).
Thus, I think the code belongs in the called form ([PopUpForm]) but I
don't
know how to modify it.

Code:
Dim strClientID as String
strClientID=Me!ClientID
Me.Requery
With Me.RecordsetClone
.FindFirst "ClientID=""" & strClientID & """"
If .NoMatch = False Then
Me.Bookmark = .Bookmark
Else
.Bookmark=Me.Bookmark
End If
End With

ClientID is a control on each form.

Can anyone be of assistance?
 
P

PC Datasheet

oooops!

Should be:
Dim Rst As DAO.Recordset

Sorry!!!!

Chris said:
Fails compile with "Rst As DAO.RecordsetClone" highlited and returns the
error message "User defined type not defined."


--
Thanks for your help,
Chris


PC Datasheet said:
Try this version of my previous code:
Dim Rst As DAO.RecordsetClone
Dim strClientID as String
strClientID=Me!ClientID
DoCmd.OpenForm "NameOfPopUpForm",,,,,acDialog
Me.Requery
Set Rst = Me.RecordsetClone
With Rst
.FindFirst "ClientID=""" & strClientID & """"
Me.Bookmark = .Bookmark
.Close
Set Rst = Nothing
End With

If it doesn't work this time, post your code in the Click event of the
button.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com



PC Datasheet said:
Put the following code in the Click event of the button on your main
form:
Dim strClientID as String
strClientID=Me!ClientID
DoCmd.OpenForm "NameOfPopUpForm",,,,,acDialog
Me.Requery
With Me.RecordsetClone
.FindFirst "ClientID=""" & strClientID & """"
If .NoMatch = False Then
Me.Bookmark = .Bookmark
Else
.Bookmark=Me.Bookmark
End If
End With


--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com




Hi...hoping for some guidance.

Two forms: [MainForm], [PopUpForm], each bound to different table.
Button on [MainForm] calls [PopUpForm].
Button on [PopUpForm] closes [PopUpForm] and focus goes back to
[MainForm].

When [MainForm] gets focus again, the first record is displayed. I
know
what
causes this; I don't wish to change that situation -- but I would like
to
return to the record I left. I successfully use the following code
several
places, however, its always only ONE form, such as [MainForm]. In this
case I
have two forms; one called ([PopUpForm]) and one "underlying"
([MainForm]).
Thus, I think the code belongs in the called form ([PopUpForm]) but I
don't
know how to modify it.

Code:
Dim strClientID as String
strClientID=Me!ClientID
Me.Requery
With Me.RecordsetClone
.FindFirst "ClientID=""" & strClientID & """"
If .NoMatch = False Then
Me.Bookmark = .Bookmark
Else
.Bookmark=Me.Bookmark
End If
End With

ClientID is a control on each form.

Can anyone be of assistance?
 
G

Guest

Yippee! It works. Thanks so much for all your help.
--

Chris


PC Datasheet said:
oooops!

Should be:
Dim Rst As DAO.Recordset

Sorry!!!!

Chris said:
Fails compile with "Rst As DAO.RecordsetClone" highlited and returns the
error message "User defined type not defined."


--
Thanks for your help,
Chris


PC Datasheet said:
Try this version of my previous code:
Dim Rst As DAO.RecordsetClone
Dim strClientID as String
strClientID=Me!ClientID
DoCmd.OpenForm "NameOfPopUpForm",,,,,acDialog
Me.Requery
Set Rst = Me.RecordsetClone
With Rst
.FindFirst "ClientID=""" & strClientID & """"
Me.Bookmark = .Bookmark
.Close
Set Rst = Nothing
End With

If it doesn't work this time, post your code in the Click event of the
button.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com



Put the following code in the Click event of the button on your main
form:
Dim strClientID as String
strClientID=Me!ClientID
DoCmd.OpenForm "NameOfPopUpForm",,,,,acDialog
Me.Requery
With Me.RecordsetClone
.FindFirst "ClientID=""" & strClientID & """"
If .NoMatch = False Then
Me.Bookmark = .Bookmark
Else
.Bookmark=Me.Bookmark
End If
End With


--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com




Hi...hoping for some guidance.

Two forms: [MainForm], [PopUpForm], each bound to different table.
Button on [MainForm] calls [PopUpForm].
Button on [PopUpForm] closes [PopUpForm] and focus goes back to
[MainForm].

When [MainForm] gets focus again, the first record is displayed. I
know
what
causes this; I don't wish to change that situation -- but I would like
to
return to the record I left. I successfully use the following code
several
places, however, its always only ONE form, such as [MainForm]. In this
case I
have two forms; one called ([PopUpForm]) and one "underlying"
([MainForm]).
Thus, I think the code belongs in the called form ([PopUpForm]) but I
don't
know how to modify it.

Code:
Dim strClientID as String
strClientID=Me!ClientID
Me.Requery
With Me.RecordsetClone
.FindFirst "ClientID=""" & strClientID & """"
If .NoMatch = False Then
Me.Bookmark = .Bookmark
Else
.Bookmark=Me.Bookmark
End If
End With

ClientID is a control on each form.

Can anyone be of assistance?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top