473,324 Members | 2,541 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Replace Null field with previous record value

I get a text file every day that has Customer ID and Product ID. The customer ID is only in the first record. I need to replicate the customer ID into each field relating to his products. Find and replace box works fine but I have hundreds to do each day. I need a to do it in the code area on "on open" or some other automatic way.
Please help me with my near vission.
Thanks,
Craig
Jun 10 '06 #1
3 2971
Banfa
9,065 Expert Mod 8TB
Erm you haven't mentioned what packages/programs you are using/you have available or what operating system you are using.
Jun 11 '06 #2
Erm you haven't mentioned what packages/programs you are using/you have available or what operating system you are using.
I use access XP on windows xp home. The file that comes to me is a .csv. I have it linked to my database and append to a table that requires the customer ID filled in - it's the index for the product ID.

Hope that is the info you were asking for.

Thanks,

Craig
Jun 12 '06 #3
Banfa,
Thanks For responding

Just got the answer. Tested it and works great.

Dim rstThis as RecordSet
Dim varField2 as Variant

Set rstThis = CurrentDB.OpenRecordset("11-SWBACKORDS-test") ' or whatever it is called

With rstThis
.MoveLast
.MoveFirst
If .RecordCount Then
Do Until .EOF
If Len(nz(!Field2, vbNullString)) Then
varField2 = !Field2
Else
.Edit
!Field2 = varField2
.Update
End If
.MoveNext
Loop
End If
.Close
End With
Set rstThis = Nothing

Thanks again,

Craig
Jun 12 '06 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

12
by: AFN | last post by:
I am running the code below to generate XML from a data table. But some fields in the data table are Null for every record. Suppose field5 has a null database value. I would expect to see: ...
2
by: Daniel | last post by:
I use an Access database to basically take data exports, import them, manipulate the data, and then turn them into exportable reports. I do this using numerous macros, and queries to get the data...
16
by: Georges Heinesch | last post by:
Hi. My form contains a control (cboFooBar), which has an underlying field with the "Required" property set to "Yes". Now, while filling out all the controls of the form, I have to fill out this...
1
by: allyn44 | last post by:
Hello, I have a table that has null fields that need to be filled in with the value of the previous record (example below) id date 1 2/2/02 2 3 4/4/02 4
2
by: MLH | last post by:
Fields in MyTable: PostID PostDate RollQtyXfer RollDenomination RollCount37 RollCount23
2
by: Brett | last post by:
My database has 2 tables: Table1 & Table2. If a field is not null on a record in table2, then the not null fields in table1 that correspond to the records in table1 needs to be updated to match the...
52
by: MP | last post by:
Hi trying to begin to learn database using vb6, ado/adox, mdb format, sql (not using access...just mdb format via ado) i need to group the values of multiple fields - get their possible...
2
by: john | last post by:
In a table I have text field A. I would like to replace all the null values in field A to a real value, let's say 'Test'. When I use Find & Replace and I search for 'is null' and I press replace or...
8
by: Jeff | last post by:
A client wants a press of the Enter key in a field on a continuous form to grab the value of that field from the previous record. But if they have typed a value and then hit Enter it shouldn't. ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.