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

Access Form open to next incomplete record

Hello,

I am building an Access Database that uses one table and two forms.

One user puts part of the information into one form as a request to be completed and another user opens their version of a form that allows them to "complete" the request by putting in their information.

I have split the database and sent all users the front end while I maintained the back end within a shared file. all updates are working just fine.

The issue that I am having is that when the second user opens the second form, the form always opens to the first record. What I want it to do is open to the first record that has a null in a specific field (the next request that I want them to process). If anyone can help me figure this out, it would be really appreciated.
Sep 25 '18 #1

✓ answered by PhilOfWalton

I am confused.

The code you posted is on the OnOpen of the form, but you are referring to the OnLoad.

The Filter needs to be applied on the OnOpen Event

So:-

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Open(Cancel As Integer)
  2.  
  3.     Me.Filter = "[Work Completed By] is Null AND [Date Completed] is Null AND [Work Comments] is Null"
  4.     Me.FilterOn = True
  5.  
  6. End Sub
This assumes you have Controls NAMED EXACTLY "Work Completed By", "Date Completed" and "Work Comments".

This should show the form only when all 3 controls are blank. Change the "AND"s to "OR"s to show the form if any one control is Null.

I Don't like the name of your Form with a minus sign in the middle. Use an underscore if you must, but what's the matter with "RequestMSA"?

Phil

13 1198
PhilOfWalton
1,430 Expert 1GB
Both forms should have an identical underlying recordsource (particularly the sort order), but in the RecordSource for form 2, you need to set the criteria that your specific field IsNull.

Phil
Sep 25 '18 #2
I am pretty new to Access, so please go easy.
Sep 25 '18 #3
The record source is the same for both forms. The first form puts in 8 fields and the second reads those fields and puts in 3 more. I want the second form to open to the next record that does not already have those 3 fields filled in. That was the Null part I was talking about.
Sep 25 '18 #4
PhilOfWalton
1,430 Expert 1GB
I'll be as gentle as I can.

Are you using a Query as the RecordSource, if so, do you know how to use the Query Design to create the query?

Phil
Sep 25 '18 #5
twinnyfo
3,653 Expert Mod 2GB
No need for a query for the record source for the second form. Just set the Filter to [FieldName] Is Null. Just make sure the FilterOn property is set to “Yes”.

Hope this hepps!
Sep 26 '18 #6
PhilOfWalton
1,430 Expert 1GB
Twinnyfo is correct, but you need to consider exactly what you mean by three fields being Null. Do you mean all 3 fields being Null, or any one of the 3 fields being Null.
I rather suspect the latter option.

If so the filter will look like
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Open(Cancel As Integer
  2.     Me.Filter = "[FieldName1] Is Null Or [FieldName2] Is Null Or [FieldName3] Is Null"
  3.     Me.FilterOn = True
  4. End Sub
Phil
Sep 26 '18 #7
Yes, all three fields would be Null in my ideal world to be honest.

Now comes the go easy on me part. How would I take that line of code and make the form to the work? The name of the Form is: "Request - MSA" and the fields that read Null are: "Work Completed By", "Date Completed" and "Work Comments".
Sep 26 '18 #8
OK, so I went to Load event for the form and added a Code event: I tried to put in the code as follows:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Open(Cancel As Integer)
  2.     Me.Filter = "[Work Completed By] Is Null"
  3.     Me.FilterOn = True
  4. End Sub
and it gave me an error: the expression On Load you entered as the event property setting produced the following error: Expected: Line number or label or statement or end of statement.



I am so lost right now.
Sep 26 '18 #9
twinnyfo
3,653 Expert Mod 2GB
You must have something in your OnLoad Event that is causing that error.
Sep 27 '18 #10
PhilOfWalton
1,430 Expert 1GB
I am confused.

The code you posted is on the OnOpen of the form, but you are referring to the OnLoad.

The Filter needs to be applied on the OnOpen Event

So:-

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Open(Cancel As Integer)
  2.  
  3.     Me.Filter = "[Work Completed By] is Null AND [Date Completed] is Null AND [Work Comments] is Null"
  4.     Me.FilterOn = True
  5.  
  6. End Sub
This assumes you have Controls NAMED EXACTLY "Work Completed By", "Date Completed" and "Work Comments".

This should show the form only when all 3 controls are blank. Change the "AND"s to "OR"s to show the form if any one control is Null.

I Don't like the name of your Form with a minus sign in the middle. Use an underscore if you must, but what's the matter with "RequestMSA"?

Phil
Sep 27 '18 #11
Rabbit
12,516 Expert Mod 8TB
Looks like you copied the line numbers, you have to get rid of those
Sep 27 '18 #12
That worked PERFECTLY!!!!! Thank you so much for the help.
Sep 27 '18 #13
PhilOfWalton
1,430 Expert 1GB
@twinnyfo

I suspect as Rabbit pointed out post No 9 did have line nos in the code. I think your edit of the post may have removed them.

@DocBlack4444

Please when you post code or SQL copy it from your Db, then use the [CODE/] that you see at the top of the box, and PASTE your VBA between the "CODE" and "/CODE".
Then we know exactly what you have.

Similarly, if someone provides you with code, Copy it from the Bytes Website and paste it into your module.

Phil
Sep 27 '18 #14

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

Similar topics

2
by: Josh Strickland | last post by:
I am attempting to create an Access database which uses forms to enter data. The issue I am having is returning the query results from the Stored Procedure back in to the Access Form. ...
13
by: Seth Spearman | last post by:
Hey guys, I have the following code: '****************************************************** If Not Me.NewRecord Then Dim rs As DAO.Recordset Dim strBookmark As String Set rs =...
9
by: Karl Roes | last post by:
Hi All, I would like some advice on Next / Previous record buttons. I have a main form for the client, and a continuous subform listing client transactions. If I open one of these transactions...
4
by: Leah Trahan | last post by:
I am new at Access, databases, AND posting threads (sorry). I have a subform that is a continuous form based on a tabular query. I enter a particular serial # (on the main form) and the subform...
3
by: getro | last post by:
Hi Everyone, I need to open an Access 2003 form to a specific record from a custom Outlook 2003 Appointment form. The form has a command button that would pass a record id to access and open the...
7
by: kpresidente | last post by:
Hello all, I'm trying to transfer the value of a control on an Access form to an Excel worksheet using VBA. The Access form is a single form with all the controls disabled, so that data is "read...
6
by: munkee | last post by:
Is there a way to automatically have a web based data access page to start on a new record when you open the page? (Without going to data entry mode in page properties) If I go to data entry mode,...
3
by: Will M | last post by:
I saw this question elsewhere on this site, but it was five years old, so I'm asking anew . . . I want to open a form in Access 2007 (on WinXP) by clicking a button on a different form, and I want...
10
RockKandee
by: RockKandee | last post by:
I am using the MS Calendar found on this site with Access 2013 on Windows 8. http://bytes.com/topic/access/answers/761255-ms-access-calendar I am working on adding a form that opens from a day...
1
by: ESAKKI109 | last post by:
In Microsoft access 2013 how can I set last record as a default without VBA coding and macro when form opens?
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.