UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> If No Record Exists Create New One, Access 2016    
 
   
osmith96
post Oct 31 2019, 11:43 AM
Post#1



Posts: 14
Joined: 25-June 19



Hey Guys,

So I have a form "Department" and in this form I select a department from the drop down list and press the continue you button which opens up a transaction form.

If I have records already created the form opens up flawlessly. But if I don't have any records created for that department I would like to have a message box that appears and asks
the user if they would want to create the first record for that department and I can't seem to figure this out. I've attached the database so you can look at what I am trying to do. The message box
code is on the on load event of the "Transactions"form.

**Updated the zip file**
This post has been edited by osmith96: Oct 31 2019, 12:24 PM
Attached File(s)
Attached File  CoffeeLog_Updated_.zip ( 198.36K )Number of downloads: 6
 
Go to the top of the page
 
MadPiet
post Oct 31 2019, 11:53 AM
Post#2



Posts: 3,365
Joined: 27-February 09



Use DCOUNT() to see if records exist for that value (in the combobox). If not, open some form in Add mode, and maybe set the value. Otherwise, open the form directly.
Go to the top of the page
 
osmith96
post Oct 31 2019, 12:04 PM
Post#3



Posts: 14
Joined: 25-June 19



Can you provide an example?
Go to the top of the page
 
tina t
post Oct 31 2019, 02:03 PM
Post#4



Posts: 6,182
Joined: 11-November 10
From: SoCal, USA


read up on the DCount() function in Access Help, so you understand how it works. read up on the OpenForm method in ditto. come back if you have specific questions or run into problems.

hth
tina

--------------------
"the wheel never stops turning"
Go to the top of the page
 
PatHartman
post Nov 3 2019, 11:49 AM
Post#5



Posts: 71
Joined: 20-February 03
From: Stratford,Ct USA


You're making this more complicated than it needs to be. Just have the Transactions form open with the subform showing. The user will see immediately whether or not there are details. If he wants to add one, he can move the cursor to the "new record" line in the subform and just start typing. You don't have to ask him a question. He just does what needs to be done.
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    9th December 2019 - 08:48 PM