Open Selected Record in form

  • Thread starter Malik via AccessMonster.com
  • Start date
M

Malik via AccessMonster.com

Hi
I have a Sales Form with the fields as SaleID, Customer Name, Sale Datails
Etc....

On the form I have an Open button which opens another form with a listbox
having all Sale Invoices Saved.

Now I want to select the record by DblClick from that listbox to open it in
Sales Form so I can edit it.

How to do that

Thanks
 
G

Graham Mandeno

Hi Malik

Assuming your listbox has the SaleID in its bound column, put this in its
DblClick event procedure:

Dim f as Form
Set f = Forms("Name of your Sales form")
With f.RecordsetClone
.FindFirst "SaleID=" & Me.[Name of textbox]
If .NoMatch then
MsgBox "Can't find that record"
Else
f.Bookmark = .Bookmark
End If
End With
 
M

malik via AccessMonster.com

Graham said:
Hi Malik

Assuming your listbox has the SaleID in its bound column, put this in its
DblClick event procedure:


Thanks Buddy But

First tell me in ur supplied code

.FindFirst "SaleID=" & Me.[Name of textbox]


Here u mean which textbox...

If it is in listbox form,,,,, Then it do not fullfill my requirement,

When I double Click Any record.. It Shows me an error

RunTime Error '2450'


What to do now.
 
G

Graham Mandeno

I meant Me.[Name of LISTbox]

I'm very sorry you weren't able to recognise my mistake.

Error 2450 indicates an incorrect reference to a form, or a reference to a
form that is not open.
Check your Set f = Forms("...") line


--
Good Luck :)

Graham Mandeno [Access MVP]
Auckland, New Zealand

malik via AccessMonster.com said:
Graham said:
Hi Malik

Assuming your listbox has the SaleID in its bound column, put this in its
DblClick event procedure:


Thanks Buddy But

First tell me in ur supplied code

FindFirst "SaleID=" & Me.[Name of textbox]


Here u mean which textbox...

If it is in listbox form,,,,, Then it do not fullfill my requirement,

When I double Click Any record.. It Shows me an error

RunTime Error '2450'


What to do now.
 

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