Minggu, 12 Mei 2013

RE: [MS_AccessPros] How to load a form (bound) without a record source - Acc2007

 

Zjubias-

The more direct way is to do:

Me.RecordSource = "SELECT * FROM tblCAFMaster " & _
"WHERE [DocID] = " & Str(Nz(Me![List53], 0))

You do not need any additional code.

That will display the ONE record selected in the List Box. Your method will
provide all records in the table but position the form at the selected
record.

John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications
SQL Queries for Mere Mortals
http://www.viescas.com/
(Paris, France)

-----Original Message-----
From: MS_Access_Professionals@yahoogroups.com
[mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of ZJUbias
Sent: Sunday, May 12, 2013 1:42 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: RE: [MS_AccessPros] How to load a form (bound) without a record
source - Acc2007

OK, I think I got the part of supplying record source after update of the
listbox, something like below. Please if this is not the correct way, please
show me the correct way.

Private Sub List53_AfterUpdate()

' Find the record that matches the control.

Me.RecordSource = "tblCAFMaster"

Dim rs As Object

Set rs = Me.Recordset.Clone

rs.FindFirst "[DocID] = " & Str(Nz(Me![List53], 0))

If Not rs.EOF Then Me.Bookmark = rs.Bookmark

End Sub

Am thinking to hide also the textbox, combo box control until the record
source is supplied, and displaying at the same time after providing the
record source.

Thank you once again,

zjubias

From: MS_Access_Professionals@yahoogroups.com
[mailto:MS_Access_Professnionals@yahoogroups.com] On Behalf Of moi
Sent: Sunday, May 12, 2013 9:07 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: [MS_AccessPros] How to load a form (bound) without a record source
- Acc2007

Dear all,

I have a bound form to view record one at a time, in this form I have also a
listbox created from a wizard to filter the record to display on the form.

What I wanted to achieve is, I will open the form with no record source
yet,on after update of listbox/search textbox it will supply the record
source of the form, displaying the record as filter on the listbox.

Can someone please guide me on how to supply the forms record source after I
selected item in my listbox.

Thank you in advance,

zjubias

[Non-text portions of this message have been removed]

------------------------------------

Yahoo! Groups Links

__._,_.___
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (3)
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar