Results 1 to 3 of 3
  1. #1
    JeroenMioch's Avatar
    JeroenMioch is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2012
    Location
    Den Haag, Netherlands
    Posts
    368

    code makes all fields empty when one field is left blanc

    Dear fellow programmers,



    Can anyone tell me why the code listed below makes the fields in my table (and thus in my continous form) go empty ?
    If i fill in all the controls it works perfectly. But when i leave one control empty then all the fields will be empty :

    See the screenshot below, if i hit the button "Opslaan"(wich means SAVE) then the data will not transfer from the line with the white background (these are not bound fields) to the records with the light grey bachground (continous form).

    Click image for larger version. 

Name:	empty_fields2.PNG 
Views:	5 
Size:	13.3 KB 
ID:	33317

    Code:
    Dim db As DAO.Database
    Dim rs As DAO.Recordset
    Dim strSQL As String
        Set db = CurrentDb
        Set rs = db.OpenRecordset("tblSluitSystemen", dbOpenDynaset)
        rs.AddNew
            rs!Soort = Me.ctrlSoort
            rs!Merk = Me.ctrlMerk
            rs!LengteBinnen = Me.ctrlLengteBinnen
            rs!LengteBuiten = Me.ctrlLengteBuiten
            rs!KnopCilinder = Me.ctrlKnopCilinder
            rs!KnopZijde = Me.ctrlKnopZijde
            rs!SerieNummer = Me.ctrlSerieNummer
            rs!Sluitsysteem = Me.ctrlSluitsysteem
            rs!UitgevenAan = Me.ctrlUitgevenAan
            rs!DatumUitgegeven = Me.ctrlDatumUitgegeven
            rs!KostenPlaats = Me.ctrlKostenPlaats
            rs!SoortObject = Me.ctrlSoortObject
            rs!Object = Me.ctrlObject
            rs!Bouwdeel = Me.ctrlBouwdeel
            rs!Etage = Me.ctrlEtage
            rs!KamerNummer = Me.ctrlKamerNummer
            rs!Historie = Me.ctrlHistorie
    
    
        rs.Update
          
     
            Me.ctrlSoort = Null
            Me.ctrlMerk = Null
            Me.ctrlLengteBinnen = Null
            Me.ctrlLengteBuiten = Null
            Me.ctrlKnopCilinder = Null
            Me.ctrlKnopZijde = Null
            Me.ctrlSerieNummer = Null
            Me.ctrlSluitsysteem = Null
            Me.ctrlUitgevenAan = Null
            Me.ctrlDatumUitgegeven = Null
            Me.ctrlKostenPlaats = Null
            Me.ctrlSoortObject = Null
            Me.ctrlObject = Null
            Me.ctrlBouwdeel = Null
            Me.ctrlEtage = Null
            Me.ctrlKamerNummer = Null
            Me.ctrlHistorie = Null

    Any help would be greatly appreciated.
    Attached Thumbnails Attached Thumbnails empty_fields.png  

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    you dont need code, run a query.

  3. #3
    JeroenMioch's Avatar
    JeroenMioch is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2012
    Location
    Den Haag, Netherlands
    Posts
    368
    It seems i made an error, ive solved it myself

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 11
    Last Post: 02-09-2017, 09:12 AM
  2. Replies: 5
    Last Post: 01-13-2015, 11:57 AM
  3. Replies: 4
    Last Post: 12-14-2014, 01:41 PM
  4. Code to check if field is empty
    By darekg11 in forum Forms
    Replies: 2
    Last Post: 09-18-2012, 03:15 PM
  5. Left Hand column in chart empty
    By Kirsti in forum Reports
    Replies: 10
    Last Post: 03-20-2012, 01:41 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums