Alpha DevCon 2018
Results 1 to 8 of 8

Thread: Blank Records

  1. #1
    Member
    Real Name
    Phil Krenzer
    Join Date
    May 2012
    Posts
    14

    Default Blank Records

    How do you prevent a user from saving blank records.

  2. #2
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,006

    Default Re: Blank Records

    One way is to immediately delete blank records after they are saved.
    The onsaverecord event in the table field rules can be utilized, the below deletes the record if the id field is left blank.

    Code:
    tbl = table.current()
    if alltrim(tbl.id) = ""
    	tbl.change_begin()
    	tbl.delete()
    	tbl.change_end()
    end if
    Another would be to display an xdialog with variables to capture the necessary field values for a record and validate the entries before writing the variables to table fields.
    Last edited by Stan Mathews; 06-21-2017 at 11:26 AM.
    There can be only one.

  3. #3
    Member
    Real Name
    Francis Dizon
    Join Date
    Jan 2006
    Location
    Philippines
    Posts
    404

    Default Re: Blank Records

    thanks very helpful
    Francis

  4. #4
    "Certified" Alphaholic Mike Wilson's Avatar
    Real Name
    mike wilson
    Join Date
    Apr 2005
    Location
    Michigan
    Posts
    4,127

    Default Re: Blank Records

    I chose the second of Stan's recommendations and I use this code to assist with preparing such dialogs.

    Code:
    dim vcollect as C=""
    dim vscope as C="shared"
    
    dim vtbl as C="your_table_here"
    dim vLfields as C=""
    vLfields=table.external_field_name_get(vtbl,"n,t,w")
    
    dim vfn as C=""
    dim vft as C=""
    dim vfw as C=""
    dim vfield_var_dim as C=""
    dim vLt_dot_field_equals as C=""
    dim vLvar_equals_tbl as C=""
    dim vdlg_fields as C=""
    for each foo in vLfields
    	vfn=alltrim(word(foo,1,","))
    	vft=alltrim(word(foo,2,","))
    	vfw=alltrim(word(foo,3,","))
    	vLt_dot_field_equals=vLt_dot_field_equals+"tss."+vfn+"=v"+vfn+crlf()
    	vLvar_equals_tbl=vLvar_equals_tbl+"v"+vfn+"=alltrim(tss."+vfn+")"+crlf()
    
    	vfield_var_dim=vfield_var_dim+"dim "+vscope+" v"+vfn+" as "+vft+crlf()
    	vdlg_fields=vdlg_fields+"{sp=3}{font=Arial,9,bi}"+vfn+": | {font=Arial,10}[."+(""+(int(val(vfw)*2)))+"v"+vfn+"!ev"+left(vfn,2)+"_*] ;"+crlf()
    next
    
    	vcollect=vfield_var_dim+crlf(2)+vLvar_equals_tbl+crlf(2)+vdlg_fields+crlf(2)+vLt_dot_field_equals+crlf()
    	clipboard.Set_Data(vcollect)
    	
    msgbox("done")
    Mike W
    __________________________
    "I rebel in at least small things to express to the world that I have not completely surrendered"

  5. #5
    Member
    Real Name
    Phil Krenzer
    Join Date
    May 2012
    Posts
    14

    Default Re: Blank Records

    Thanks Stan as usual you helped me again many thanks

  6. #6
    Member
    Real Name
    Phil Krenzer
    Join Date
    May 2012
    Posts
    14

    Default Re: Blank Records

    Thanks for info very helpful

  7. #7
    Member
    Real Name
    Edward paul
    Join Date
    Aug 2017
    Posts
    10

    Default Re: Blank Records

    I have an excel data source with several rows, when I use this source MailMerge using Microsoft word, I encounter a problem, for some cases, the word document has blank fields (meaning, there are no record in excel, but due to word template, there are pages, but without the data from excel - with only the template contents). I'm currently working on a VBA to automate my Mailmerge, but because of this, my macro doesn't work that efficiently. Your help would be greatly appreciated!! Thank you!!

  8. #8
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,006

    Default Re: Blank Records

    I suggest you ask one of the moderators to move your post to the proper forum. The thread to which you attached your question deals with preventing blank records being entered in a native Alpha dbf in a desktop application. It has nothing to do with mailmerge, VBA, macros, or excel. All of your previous posts seem to have been in the Web/Mobile forum area. This is not that.
    There can be only one.

Similar Threads

  1. Editing Queried Records creates blank records
    By MoGrace in forum Windows Desktop Applications
    Replies: 6
    Last Post: 02-12-2017, 06:09 PM
  2. what can cause blank records?
    By Steve Wood in forum Alpha Five Version 8
    Replies: 6
    Last Post: 02-20-2008, 09:39 PM
  3. Blank records
    By Al Lenkner in forum Alpha Five Version 6
    Replies: 2
    Last Post: 09-08-2004, 01:44 PM
  4. blank records
    By Karen Cudworth in forum Alpha Five Version 5
    Replies: 3
    Last Post: 01-07-2004, 04:00 AM
  5. blank records
    By C Johnson in forum Alpha Five Version 5
    Replies: 0
    Last Post: 07-29-2003, 06:37 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •