473,385 Members | 1,351 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,385 software developers and data experts.

Records Incomplete status

Narender Sagar
189 100+
Hi All
I have created a table in which multiple users have to maintain some data (one after other user). So I can't have option of having compulsory fields (Required property- Yes), because all the fields will not be maintained at once. However, I want to show Record status as incomplete (logically or by any means) until all the records are maintained.
Any advise..?
thanks
Sep 4 '16 #1

✓ answered by zmbd

If the fields are numeric then you might also test against the zero value.
Its quirk in Access, I'm guessig, as the string method I offered seems to break for numerics as I mentioned.

Here's a bit if a kludge work around for the numeric fields use the isnull() and for the text fields the string approach so we get something like:

Expand|Select|Wrap|Line Numbers
  1. =IIf(
  2.       IsNUll([NF1]+[NF2]+[NF3])
  3.          OR
  4.      (([TxtF1] + [TxtF2] & "")="")
  5.    ,"Fail"
  6.    ,"Pass")
You might also need to have a refresh/requery in the after_update of the record against the flag.

10 1022
ben1988
23
i guess;

u can do on load the form vba which check
Expand|Select|Wrap|Line Numbers
  1. if isnull(field1) & isnull(field1) then
  2. textbox.value="this form is incomplete"
  3. end if
or

Expand|Select|Wrap|Line Numbers
  1. textbox.value= ((isnull(field1) + isnull(field1))/2)*100 & "% of the form complete"
Sep 4 '16 #2
Narender Sagar
189 100+
Thanks Ben
I'm looking for for similar kind of solution. However, when I tried first option, I'm getting Run Time error '13' Type Mismatch
Please help..
thanks
Sep 5 '16 #3
zmbd
5,501 Expert Mod 4TB
Expand|Select|Wrap|Line Numbers
  1. if ((rs![Field1] + rs![Field2] + rs![Field2] & "")="") Then
  2. '(...)
  3. END IF
This way if the value is null or an empty string then the returned is an empty string which is tested against.
If the fields are numeric then you might also test against the zero value. I personally will set a default of -2,147,483,648 for numeric(long) fields as it is the most negative value for numeric(long) fields and test against that value.

Simularly for the control data source:
Expand|Select|Wrap|Line Numbers
  1. =IIf(([Field1] + [Field2] & "")="","Fail","Pass")
See if this article will help:
Bytes > Sitemap > Microsoft Access / VBA Insights>What is Null?
Sep 5 '16 #4
Narender Sagar
189 100+
Thank ZMBD
I'm able to understand your statement. But not able to get the final result I want. I tried control data source method, but its only showing "pass". Although various fields are null.
Sep 6 '16 #5
zmbd
5,501 Expert Mod 4TB
opps,
Sorry, the expression should have had "+" for all but the last empty string:

=IIf(([Field1] + [Field2] & "")="","Fail","Pass")
Sep 6 '16 #6
jforbes
1,107 Expert 1GB
I know I'm jumping in here a little late. What ZMBD has going on there is great and a good solution, and for a lot of cases probably the best solution. But when I run into something like this, I sometimes like to consider building a a function to validate a Status as it tends to be more versatile.

Usually the function takes in the RecordID, looks it up and determines the Status, then Returns the Status. The following is a generic version of it, it probably has some errors as I copied and pasted the bulk of it:
Expand|Select|Wrap|Line Numbers
  1. Public Function validateThing(ByRef sThingID As String) As String
  2. On Error GoTo ErrorOut
  3.  
  4.     Dim sSQL As String
  5.     Dim oRst As DAO.Recordset    
  6.  
  7.     sSQL = ""
  8.     sSQL = sSQL & "SELECT "
  9.     sSQL = sSQL & "  Status "
  10.     sSQL = sSQL & ", Quantity "
  11.     sSQL = sSQL & ", Description "
  12.     sSQL = sSQL & "FROM Things "
  13.     sSQL = sSQL & "WHERE ThingID='" & sThingID & "' "
  14.  
  15.     Set oRst = CurrentDB.OpenRecordset(sSQL)
  16.     If oRst.RecordCount > 0 Then
  17.  
  18.         ' Status
  19.         Select Case Nz(oRst!Status, "C")
  20.              Case "C"
  21.                 validateThing = "Closed"
  22.                 GoTo ExitOut
  23.              Case "H"
  24.                 validateThing = "Hold"
  25.                 GoTo ExitOut
  26.         End Select
  27.  
  28.         ' Quantity
  29.         If Nz(oRst!Quantity, 0) <= 0 Then 
  30.             validateThing = "Quantity Missing"
  31.             GoTo ExitOut
  32.         End If
  33.  
  34.         ' Description
  35.         If Len(Nz(oRst!Description, "")) = 0 Then 
  36.             validateThing = "Description Missing"
  37.             GoTo ExitOut
  38.         End If
  39.  
  40.         validateThing = "Ready"
  41.     Else
  42.         validateThing = sThingID & " was Not Found"
  43.     End If
  44.     oRst.Close
  45.  
  46.  
  47. ExitOut:
  48.     Exit Function
  49.  
  50. ErrorOut:
  51.     Call MsgBox(Err.Description, vbCritical + vbOKOnly, gLongAppName)
  52.     Resume ExitOut
  53.  
  54. End Function
Once you have a function like this, you can set the ControlSource of a TextBox to something like:
Expand|Select|Wrap|Line Numbers
  1. =validateThing([ThingID])
Then if you decide to build a Form Validator:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_BeforeUpdate(Cancel As Integer)
  2.     Cancel = (validateThing(Me!ThingID) <> "Ready")
  3. End Sub
Sep 6 '16 #7
Narender Sagar
189 100+
Hi ZMBD,
When I used following fields :
Expand|Select|Wrap|Line Numbers
  1. =IIf(([VariantCode]+[FGCode]+[ProductName]+[PaymentTerms]+[ProductRegistration]+[DlvTerms] & "")="","Fail","Pass")
the result is ok. But if I add any numeric field in the above formula :
Expand|Select|Wrap|Line Numbers
  1. =IIf(([VariantCode]+[FGCode]+[ProductName]+[BatchSize]+[QtyInNumber]+[QtyInPack]+[Price]+[PaymentTerms]+[ProductRegistration]+[DlvTerms] & "")="","Fail","Pass")
, I'm getting #Type!" error.
Sep 6 '16 #8
Narender Sagar
189 100+
Hi Jforbs,
Thanks for your response. To be honest, I think code you have given is too much for me to understand or even take a rough trial.
Thanks again.
Sep 6 '16 #9
zmbd
5,501 Expert Mod 4TB
If the fields are numeric then you might also test against the zero value.
Its quirk in Access, I'm guessig, as the string method I offered seems to break for numerics as I mentioned.

Here's a bit if a kludge work around for the numeric fields use the isnull() and for the text fields the string approach so we get something like:

Expand|Select|Wrap|Line Numbers
  1. =IIf(
  2.       IsNUll([NF1]+[NF2]+[NF3])
  3.          OR
  4.      (([TxtF1] + [TxtF2] & "")="")
  5.    ,"Fail"
  6.    ,"Pass")
You might also need to have a refresh/requery in the after_update of the record against the flag.
Sep 6 '16 #10
Narender Sagar
189 100+
Thanks zmbd.
This gave me desired result. I guess if its date fields, it will be treated as numeric fields!
regards,
Sep 7 '16 #11

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

Similar topics

3
by: Steve | last post by:
I have a query that returns raw tick data from a table. Unfortunately after even a few days there are hundreds of thousands of rows so the following query is not efficient. SELECT * FROM...
11
by: jsfromynr | last post by:
Hi all, Here is the table and DML statments CREATE TABLE ( , NULL , DEFAULT (1), -- 1 Pending ,2 Approved (20) )
2
by: Jennifer | last post by:
I have a query with 5 possible criteria via a form. If criteria is not entered, I use the like Nz() function on the backend query to use an "*" for criteria fields left blank. The query is not...
1
by: rdraider | last post by:
Hi all, We have an app that uses SQL 2000. I am trying to track when a code field (selcode) is changed on an order which then causes a status field (status) to change. I tried a trigger but...
2
by: PhilOwens | last post by:
Morning/Afternoon all, Having slight problem with showing users the progress of a query..... Bit of background....The database allows users to view the status of documents i.e. Completion date,...
14
by: bcap | last post by:
Hello, I really would apprciate help! =) What I want to do is be able to change the status of mulitple records using a drop down and a checkbox. I have a drop down called "ChangeStatus"...
2
by: Asril | last post by:
I am attempting to use Access to email a supervisor a list of employee timecards that were not completed on a daily basis. The list of supervisors being emailed can changeday to day along with the...
4
by: sparks | last post by:
Some of the people are requiring a personID to be in the records and of course formatted as 001 002....etc so its a text field. Now they are also skipping this field and putting in stuff and just...
4
by: robtyketto | last post by:
Greetings, I added my error checking (see code below) on the Form "On Current" event as I believe this code will run upon any action on screen being actioned. Errors happen when users are...
4
tsubasa
by: tsubasa | last post by:
I have an native ASP page that is used to login and uses the email address to sort records in another page. On the page where the sorting is done, the email is compared with two columns where it...
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.