VBA code which run on 1 record at a time but not on a table at once

M

mstremmelaar

Hello,

I have the following code which makes the "Dossiercode" and
"Dossiernaam" in the table "Dossiergegevens".

But it only works if I let it run on one record, when I make the code
run on the Form it will give an error on the "Dossiernaam =
DNVariabeleStraatnaam + DNVariabeleHuisnummer + DNVariabeleToevoeging
+ DNVariabelePlaats + DNVariabeleEvtToevoeging"

the code is shown below:

Dim DCVariabelePostcode As String
Dim DCVariabeleStraatnaam As String
Dim DCVariabeleHuisnummer As String
Dim DCVariabeleToevoeging As String
Dim DCVariabelePlaats As String
Dim DCVariabeleEvtToevoeging As String

Dim DNVariabeleStraatnaam As String
Dim DNVariabeleHuisnummer As String
Dim DNVariabeleToevoeging As String
Dim DNVariabelePlaats As String
Dim DNVariabeleEvtToevoeging As String

If IsNull(Postcode) = True Then DCVariabelePostcode = ""
If IsNull(Postcode) = False Then DCVariabelePostcode = Postcode
If IsNull(Huisnummer) = True Then DCVariabeleHuisnummer = ""
If IsNull(Huisnummer) = False Then DCVariabeleHuisnummer = Huisnummer
If IsNull(Toevoeging) = True Then DCVariabeleToevoeging = ""
If IsNull(Toevoeging) = False Then DCVariabeleToevoeging = "-" +
Toevoeging
If IsNull(evt_Toevoeging_tbv_herkenning_dossiercode) = True Then
DCVariabeleEvtToevoeging = ""
If IsNull(evt_Toevoeging_tbv_herkenning_dossiercode) = False Then
DCVariabeleEvtToevoeging = " " +
evt_Toevoeging_tbv_herkenning_dossiercode

If IsNull(Straatnaam) = True Then DNVariabeleStraatnaam = ""
If IsNull(Straatnaam) = False Then DNVariabeleStraatnaam = Straatnaam
If IsNull(Huisnummer) = True Then DNVariabeleHuisnummer = ""
If IsNull(Huisnummer) = False Then DNVariabeleHuisnummer = " " +
Huisnummer
If IsNull(Toevoeging) = True Then DNVariabeleToevoeging = ""
If IsNull(Toevoeging) = False Then DNVariabeleToevoeging = "-" +
Toevoeging
If IsNull(Plaats) = True Then DNVariabelePlaats = ""
If IsNull(Plaats) = False Then DNVariabelePlaats = " " + Plaats
If IsNull(evt_Toevoeging_tbv_herkenning_dossiercode) = True Then
DNVariabeleEvtToevoeging = ""
If IsNull(evt_Toevoeging_tbv_herkenning_dossiercode) = False Then
DNVariabeleEvtToevoeging = " " +
evt_Toevoeging_tbv_herkenning_dossiercode

Dossiernaam = DNVariabeleStraatnaam + DNVariabeleHuisnummer +
DNVariabeleToevoeging + DNVariabelePlaats + DNVariabeleEvtToevoeging
Dossiercode = DCVariabelePostcode + DCVariabeleHuisnummer +
DCVariabeleToevoeging + DCVariabeleEvtToevoeging

thanks in advance..

Michael
 
S

Steve Sanford

I am very confused on what you are trying to do.

You cannot "...make the code run on the Form ". Is the code part of a Sub
or Function??

Are you trying to update tweo fields in a table??

Would you explain a little more???
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top