How to Convert or return null instead of "" in Ms Access

nector

Member
Local time
Today, 12:28
Joined
Jan 21, 2020
Messages
521
Daer All,

I thought the issue below is the simplest one, but it turned out to be trick.

I have a field in MS Access sometimes its empty and sometimes it has a value, now in Json structure it is returning "" instead of null the accepted object, so I tried this but still failed, it keeps on returning "" instead of null

Code:
If(Me.Lpo = "")Then
Me.Lpo = null
End if
 
If(Me.Lpo = """"")Then
Me.Lpo = null
End if
 
What is Me.Lpo? Is it a textbox in a form?
What does the code for the json conversion look like?
Maybe the null handling is missing there.
 
What is Me.Lpo? Is it a textbox in a form?
What does the code for the json conversion look like?
Maybe the null handling is missing there.
Ok

Sorry I mistyped it Me.txtlpo which is a txt box
 
I suspect that the code shown does not remedy this because it may not change anything.
try:
Code:
If(Me.txtLpo = "")Then
   Me.txtLpo = null ' ... this is Null .. the Json structure should contain the string null.
   stop ' does the code stop here?
End if
If there is no text in a text field, the manually not entered / deleted value is usually Null and not "" (vbnullstring).

How to pass the content of Me.txtLpo to the json converter?
 
Last edited:
Many thank to Josef & arnelgp I have finally concluded this serial port project and its now working very fast and ok. Both the header and the tail + CRC are super

The final results looks like this "LocalPurchaseOrder": null,

Code:
]  é{
   "PosVendor": "Nector Prime Accounting Solutions",
   "PosSoftVersion": "2.0.0.1",
   "PosModel": "Cap-2017",
   "PosSerialNumber": "18000018963",
   "IssueTime": "20230213155531",
   "TransactionType": 1,
   "PaymentMode": 1,
   "SaleType": 1,
   "LocalPurchaseOrder": null,
   "Cashier": "Admin Manager",
   "BuyerTPIN": null,
   "BuyerName": null,
   "BuyerTaxAccountName": null,
   "BuyerAddress": null,
   "BuyerTel": null,
   "OriginalInvoiceCode": "000230110000",
   "OriginalInvoiceNumber": "00000909",
   "Memo": "Being Reversal For Wrong Transactions",
   "Currency-Type": "ZMW",
   "Conversion-Rate": 1,
   "Items": [
      {
         "ItemId": 1,
         "Description": "MIRINDA ORANGE 350 MLS",
         "BarCode": "009090",
         "Quantity": -1,
         "UnitPrice": 30,
         "Discount": 0,
         "TaxLabels": [
            "A"
         ],
         "TotalAmount": -30,
         "IsTaxInclusive": true,
         "RRP": 0
      }
   ]
}þð

I really like the speed as if I'm not connecting to cloud Azure database! Now it's time for to contribute to site as well.
 

Users who are viewing this thread

Back
Top Bottom