PC Review


Reply
Thread Tools Rate Thread

Bookmark Listbox

 
 
Secret Squirrel
Guest
Posts: n/a
 
      12th Nov 2008
I have an unbound listbox on my form that lists all my employees. When I
create a new employee using this form and then click my comman button to save
my record it adds this new employee to the listbox but it does not select
that employee in my listbox even though I'm still on that current record on
my form. I'm using this to bookmark it but it doesn't seem to be working.

Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[LastFirst] = '" & Me![EmployeeList] & "'"
Me.Bookmark = rs.Bookmark
 
Reply With Quote
 
 
 
 
tina
Guest
Posts: n/a
 
      12th Nov 2008
you're running code in the Save command button's procedure that requeries
the listbox after the record is saved, correct? just add code to set the
value of the listbox control equal to the value of the primary key of the
current record in the form, as

Me!ListboxName = Me!CurrentRecordPrimaryKeyField

hth


"Secret Squirrel" <(E-Mail Removed)> wrote in
message news:3F71A783-06A9-4934-A0B8-(E-Mail Removed)...
> I have an unbound listbox on my form that lists all my employees. When I
> create a new employee using this form and then click my comman button to

save
> my record it adds this new employee to the listbox but it does not select
> that employee in my listbox even though I'm still on that current record

on
> my form. I'm using this to bookmark it but it doesn't seem to be working.
>
> Dim rs As Object
>
> Set rs = Me.Recordset.Clone
> rs.FindFirst "[LastFirst] = '" & Me![EmployeeList] & "'"
> Me.Bookmark = rs.Bookmark



 
Reply With Quote
 
Secret Squirrel
Guest
Posts: n/a
 
      12th Nov 2008
Hi Tina,

I'm actually just running a Me.recalc in the save command, not a requery.
This way it recalcs the record so I don't requery back to the first record.
When it fires it keeps that new record on my form and adds the new employee
to the list box but it doesn't select that employee in the listbox. Should I
just run what you said and leave the bookmark out?

"tina" wrote:

> you're running code in the Save command button's procedure that requeries
> the listbox after the record is saved, correct? just add code to set the
> value of the listbox control equal to the value of the primary key of the
> current record in the form, as
>
> Me!ListboxName = Me!CurrentRecordPrimaryKeyField
>
> hth
>
>
> "Secret Squirrel" <(E-Mail Removed)> wrote in
> message news:3F71A783-06A9-4934-A0B8-(E-Mail Removed)...
> > I have an unbound listbox on my form that lists all my employees. When I
> > create a new employee using this form and then click my comman button to

> save
> > my record it adds this new employee to the listbox but it does not select
> > that employee in my listbox even though I'm still on that current record

> on
> > my form. I'm using this to bookmark it but it doesn't seem to be working.
> >
> > Dim rs As Object
> >
> > Set rs = Me.Recordset.Clone
> > rs.FindFirst "[LastFirst] = '" & Me![EmployeeList] & "'"
> > Me.Bookmark = rs.Bookmark

>
>
>

 
Reply With Quote
 
Secret Squirrel
Guest
Posts: n/a
 
      12th Nov 2008
Yep, that worked. Thanks for your help Tina!
You can disregard my other response.

SS

"tina" wrote:

> you're running code in the Save command button's procedure that requeries
> the listbox after the record is saved, correct? just add code to set the
> value of the listbox control equal to the value of the primary key of the
> current record in the form, as
>
> Me!ListboxName = Me!CurrentRecordPrimaryKeyField
>
> hth
>
>
> "Secret Squirrel" <(E-Mail Removed)> wrote in
> message news:3F71A783-06A9-4934-A0B8-(E-Mail Removed)...
> > I have an unbound listbox on my form that lists all my employees. When I
> > create a new employee using this form and then click my comman button to

> save
> > my record it adds this new employee to the listbox but it does not select
> > that employee in my listbox even though I'm still on that current record

> on
> > my form. I'm using this to bookmark it but it doesn't seem to be working.
> >
> > Dim rs As Object
> >
> > Set rs = Me.Recordset.Clone
> > rs.FindFirst "[LastFirst] = '" & Me![EmployeeList] & "'"
> > Me.Bookmark = rs.Bookmark

>
>
>

 
Reply With Quote
 
tina
Guest
Posts: n/a
 
      12th Nov 2008
you're welcome, hon. btw, let me just mention that i assumed you were
running code from the cmd button, after the save command, to requery *the
listbox*, not the entire form.


"Secret Squirrel" <(E-Mail Removed)> wrote in
message news659E39B-4005-49E6-A55D-(E-Mail Removed)...
> Yep, that worked. Thanks for your help Tina!
> You can disregard my other response.
>
> SS
>
> "tina" wrote:
>
> > you're running code in the Save command button's procedure that

requeries
> > the listbox after the record is saved, correct? just add code to set the
> > value of the listbox control equal to the value of the primary key of

the
> > current record in the form, as
> >
> > Me!ListboxName = Me!CurrentRecordPrimaryKeyField
> >
> > hth
> >
> >
> > "Secret Squirrel" <(E-Mail Removed)> wrote in
> > message news:3F71A783-06A9-4934-A0B8-(E-Mail Removed)...
> > > I have an unbound listbox on my form that lists all my employees. When

I
> > > create a new employee using this form and then click my comman button

to
> > save
> > > my record it adds this new employee to the listbox but it does not

select
> > > that employee in my listbox even though I'm still on that current

record
> > on
> > > my form. I'm using this to bookmark it but it doesn't seem to be

working.
> > >
> > > Dim rs As Object
> > >
> > > Set rs = Me.Recordset.Clone
> > > rs.FindFirst "[LastFirst] = '" & Me![EmployeeList] & "'"
> > > Me.Bookmark = rs.Bookmark

> >
> >
> >



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
link from outlook to word bookmark opens doc but not at bookmark JOH Microsoft Outlook 1 2nd May 2008 03:58 AM
.Bookmark = .RecordsetClone.Bookmark =?Utf-8?B?cmVkRnJlZA==?= Microsoft Access Form Coding 3 19th Oct 2007 07:19 PM
Bookmark page rather than bookmark site =?Utf-8?B?RG91ZyBTdGV3YXJ0?= Microsoft Frontpage 7 4th Mar 2007 05:00 PM
My noteref to valid bookmark says "Error! Bookmark not defined."? =?Utf-8?B?amNoaWxkZXJzXzk4?= Microsoft Word Document Management 3 5th Oct 2006 02:23 PM
Listbox bookmark error Nick Mirro Microsoft Access Form Coding 5 5th Sep 2003 11:05 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:24 AM.