Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Create New Record Not Exist
Jon Capps 
       
4 years ago
I am sure there is a video, I did a search, and kept narrowing it down to Create and did not find what I was looking for. I need to open a form, and as the form opens it will search for a record to see if it exist, if it does not to create one from fields from the previous form. If the record does exist then just edit the data if necessary. I tried to do this over the weekend I wrecked my data base.


Code
'open Cincinnati cover page creation and relabel images.
'is there a Matching Cincinnati record for WOnum?
Dim CinMathingRecord As Boolean
Dim CLMFL, CLMFirstLast As String

CLMFL = Me!CLMFL ' dont think this is right
CinMathingRecord = DCount("*", "CincinnatiCoverQ2", "WoNum=" & "WoNum")

If CinMathingRecord = True Then
MsgBox "Record Exist, going to edit record"
DoCmd.OpenForm "CincinnaticoverF", acNormal, , "wonum=" & WoNum
'Me!CLMFL = CLMFirstLast

' no mathing record, so add one
Else
DoCmd.OpenForm "CincinnatiCoverF", acNormal, , , acFormAdd, acWindowNormal 'add record
End If

' some how my other tables got goofed up copying data from one form to another form .
'DoCmd.OpenForm "CincinnatiCoverF", , , "wonum=" & WoNum
'WoNum = Me!WoNum
'Clmnum = Me!Clmnum
'AdjNameC = Me!AdjNameC
'[InspDate] = Me!InspDate

'Above is the data from the first form, and the next section is to copy data to the next form.
'Me!WoNum = WoNum
'Me!Clmnum = Clmnum
'Me!AdjNameC = AdjusterC
'Me!InspDate = InspDate

Jon Capps OP  @Reply  
       
4 years ago
when this code process, my adjuster field is changed to empty data and all the entire table with this field is blank
Adam Schwanz  @Reply  
           
4 years ago
I'm not sure on a video but a few things
If CinMathingRecord = True Then - Your using dcount to count the records, should be if > 0
"WoNum=" & "WoNum") - Extra Quotations?

Adam Schwanz  @Reply  
           
4 years ago
Duplicate Record This might be what you need
Jon Capps OP  @Reply  
       
4 years ago
okay, I tired that, I know the record exist, and the form is not loading up with the data

CinMathingRecord = DCount("*", "CincinnatiCoverQ2", "WoNum=" & WoNum)

If CinMathingRecord > 0 Then
MsgBox "Record Exist, going to edit record"
DoCmd.OpenForm "CincinnaticoverF", acNormal, , "wonum=" & WoNum



Adam Schwanz  @Reply  
           
4 years ago
You also need Value From a Form if your setting the values from the other forms open button.
Adam Schwanz  @Reply  
           
4 years ago
WoNum = Me!WoNum changed to
Forms!CincinnaticoverF!WONum = WoNum

etc..
Kevin Robertson  @Reply  
          
4 years ago
Have you changed the variable type of CinMathingRecord from a Boolean to a Long?

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/2/2026 8:58:55 AM. PLT: 0s