Displaying Records

Drunkenneo

Registered User.
Local time
Today, 04:56
Joined
Jun 4, 2013
Messages
192
I am on code want to display records on the form by order_number, but i am unable to do it.
Please help me if i am going wrong anywhere:

Private Sub Combo63_AfterUpdate()
Dim rs As DAO.Recordset
Dim intcount As Integer

On Error GoTo ErrorHandler
Set rs = CurrentDb.OpenRecordset("SELECT * FROM Master_Log WHERE Order_number = " & Combo63.Value & "", dbOpenSnapshot)
intcount = CurrentDb.Recordsets.Count
Debug.Print intcount
For Each rs In CurrentDb.Recordsets
Debug.Print "Open recordset: " & rs.NextRecordset
Next rs
ErrorHandler:
MsgBox "Error No: " & Err.Number & "; Description: " & _
Err.Description
Exit Sub
End Sub
 
The code you show just displays a recordset and has nothing to do with a form.
I am not sure what you want to do yet or what you are asking.

Your code looks OK as far as it goes.

Please tell us what you are wanting to do

Dale
 
i want to display this result in Form
 
Manually set the record source of your form to your table.

Then set the filter for your form using code something like this:

Code:
Me.Filter = "[Order_number]=" & Me.Combo63.Value
Me.FilterOn = True

hth
Chris
 
Its working , but showing only one records for order_number where as there are cases where there are more records for one order number.
 
How have you set up your form? Is it in "single form" view or "continuous forms" viwe or maybe "Datasheet" view? Single form will only show a single record.
 
Thanks its been solved now, as i had set it on single form i changed it to continous.
:o
 

Users who are viewing this thread

Back
Top Bottom