Continuous form

gawai

New Member
Joined
Mar 1, 2014
Messages
15
PHhHu.png

hi,
i have issue with continuous form, there are 2 rows(records) matching name but form showing only 1 -last record.
below screen for ref.


any idea ?
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
56,916
Office Version
  1. 365
Platform
  1. Windows
How much room have you left in your Detail section of your Form to return the results?
With Continuous Forms, you typically want it to be only one record high, and set the "Can Grow" property to "Yes".
 

gawai

New Member
Joined
Mar 1, 2014
Messages
15
@joe4, the is enough room (10-12 records can accommodate) , u can see the height of form.

here is the code.


Private Sub cmbClientName_Change()
Dim db As Database
Dim rs As DAO.Recordset
Dim strConnect As String
Dim strSql As String




clntName = cmbClientName.Text

strSql = "SELECT * FROM Tbl WHERE ClientName = '" & clntName & "'"
Set db = OpenDatabase("c:\path\DB.accdb")
Set rs = db.OpenRecordset(strSql)



If (rs.RecordCount) > 0 Then
rs.MoveLast
rs.MoveFirst

lblRecFound.Caption = rs.RecordCount & " Record Found "

BillingAddress = rs.Fields("BillingAddress")
Me.fldBillAdd.Value = BillingAddress

For foundRec = 1 To rs.RecordCount
foundID = rs.Fields("ID")
clntName = rs.Fields("ClientName")
Rno = rs.Fields("ReceiptNo")
Rdate = rs.Fields("ReceiptDate")
Ramount = rs.Fields("Amount")
Ir = rs.Fields("InvoiceNo")
Pr = rs.Fields("ProjectRef")

fldID.Value = foundID
fldReceiptNo.Value = Rno
fldDate.Value = Rdate
fldAmount.Value = Ramount
fldInvoiceNo.Value = Ir
fldProjectRef.Value = Pr

rs.MoveNext
Next foundRec
Else


MsgBox "Record not found", vbOKOnly + vbInformation, "No Record"

End If


rs.Close
Set rs = Nothing


End Sub
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
56,916
Office Version
  1. 365
Platform
  1. Windows
the is enough room (10-12 records can accommodate) , u can see the height of form.
Just the opposite. You usually do NOT want to do this. Only make it high enough for one record, and set the "Can Grow" Property of the Detail Section to "Yes". Otherwise, you have too much white space when you only have a few records, and it could push things out of view or onto the next page (for Reports).
 

gawai

New Member
Joined
Mar 1, 2014
Messages
15

ADVERTISEMENT

Oh.u r.rite i forgot that. I will.try that in the morning. Thanks
But i cant find CAN GROW in the properties...
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
56,916
Office Version
  1. 365
Platform
  1. Windows
But i cant find CAN GROW in the properties...
Make sure that you are looking at the Properties of JUST the Detail section (and not the whole Form).
In is under the Format tab in the Properties.
 

gawai

New Member
Joined
Mar 1, 2014
Messages
15
How much room have you left in your Detail section of your Form to return the results?
With Continuous Forms, you typically want it to be only one record high, and set the "Can Grow" property to "Yes".

ok. it is by default "YES"

i changed the form size also but no luck. still it is showing only last record.
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
56,916
Office Version
  1. 365
Platform
  1. Windows
It is a little difficult to figure without having access to your Form to see exactly how it is designed, but in looking at the VBA code, it looks like you are looping through your records to the last one, so I think that would only return the last record:
Code:
[COLOR=#333333]rs.MoveNext[/COLOR]
[COLOR=#333333]Next foundRec[/COLOR]
 

Watch MrExcel Video

Forum statistics

Threads
1,129,577
Messages
5,637,193
Members
416,960
Latest member
Carbon1198

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top