Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cascading data in blank field from last non blank field

Status
Not open for further replies.

tonymontana69

Programmer
Feb 2, 2006
4
GB
Hello, can you help? I want to input a report from an old style program. The report can be imported into a table as a fixed width file, but fields 1 & 2 (account number & name) are only listed in the initial record of each account. I would like to cascade data down through each record until the next new account is encountered where the data to cascade will be amended.
Thanks.
 
Create an updateable recordset, advance to the first record, stick the values from the account number and name fields into 2 variables (hAcctNumber and hName

Keep stepping thru the records in the recordset and within that loop insert code something this:

If len(trim(rst.AcctNumber)) = 0 Then
rst.AcctNumber = hAcctNumber
Else
hAcctNumber = rst.AcctNumber
End If

If len(trim(rst.Name)) = 0 Then
rst.Name = hName
Else
hName = rst.Name
End If

rst.Update

HTH
 
Thanks I just got to learn how to connect properly and I'm well away. Thanks a million.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top