Just checking something – is creating an unbound form to input a new record as simple as using the form wizard, and then removing the table from the control source?
![]() |
There are isolated problems with current patches, but they are well-known and documented on this site. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
Unbound form to input new record (2000)
Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Unbound form to input new record (2000)
- This topic has 14 replies, 4 voices, and was last updated 19 years, 12 months ago.
AuthorTopicWSNYIntensity
AskWoody LoungerJune 8, 2005 at 11:12 pm #420501Viewing 1 reply threadAuthorReplies-
WSHansV
AskWoody LoungerJune 8, 2005 at 11:16 pm #952375You must clear the Record Source of the form as a whole, and the Control Source of all bound controls.
Plus, you must create code to save the data entered by the user, for example in the On Click event procedure of an ‘OK’ or ‘Save’ button. Since the form is now unbound, the data won’t be saved automatically.
-
WSNYIntensity
AskWoody Lounger -
WSHansV
AskWoody Lounger -
WSNYIntensity
AskWoody LoungerJune 8, 2005 at 11:35 pm #952379Wow…I have some very monotonous typing to do (over 50 fields). Now since I’ve got multiple tables this data needs to get inputted into, how do I specify which table it’s going to? The PK is SSN, and for example,
tblPersonnel
SSN
LName
FName
MItlbContact
SSN
HomeAddress
HomePhoneDo I just repeat the code specifying a different table before End Sub?
I planned on using rst.Close like this:
ExitHandler:
On Error Resume Next
rst.Close
Set rst = Nothing
Set cnn = Nothing
Exit Sub -
WSHansV
AskWoody LoungerJune 8, 2005 at 11:44 pm #952380For each table you want to add a record to, you must have code of the form
rst.Open “NameOfTheTable”, …
rst.AddNew
rst!Field1 = …
rst!Field2 = …
rst.Update
rst.Close(you MUST close the recordset for each individual table, not just at the end of the code)
If TableB has a foreign key that is linked to the primary key in TableA, make sure that you create and update the record in TableA before you create the record in TableB.
-
WSNYIntensity
AskWoody LoungerJune 9, 2005 at 9:20 pm #952627I’ve followed the steps, done the work, checked it twice, and now I get this error (vbExclamation)
_____________________________________________________________________________________________
Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.
_____________________________________________________________________________________________Here’s the code I have associated with the command button (cmdAddNew), as well as the form itself:
_______________________________
‘Adds record from unbound form to three separate tablesPrivate Sub cmdAddNew_Click()
Dim cnn As ADODB.Connection
Dim rst As New ADODB.RecordsetOn Error GoTo ErrHandler
Set cnn = CurrentProject.Connection
rst.Open “tblPersonnel”, cnn, adOpenKeyset, adLockOptimistic, adCmdTableDirect
rst.AddNew
rst!Ssn = txtSSN
rst!COMPANY = cboCOMPANY
rst!GRADE = cboGRADE
rst!LOCATION = cboLOCATION
rst!RANK = cboRANK
rst!GLASSES = chkGLASSES
rst!ALLERGIES = txtALLERGIES
rst!BLD_TYP = txtBLD_TYP
rst!DCTB = txtDCTB
rst!DOB = txtDOB
rst!DOR = txtDOR
rst!EAS = txtEAS
rst!EYE_CLR = txtEYE_CLR
rst!FNAME = txtFNAME
rst!HAIR_CLR = txtHAIR_CLR
rst!HT = txtHT
rst!LNAME = txtLNAME
rst!MEAL_CARD = txtMEAL_CARD
rst!MI = txtMI
rst!MOS = txtMOS
rst!PEBD = txtPEBD
rst!RELIGION = txtRELIGION
rst!SEX = txtSEX
rst!SVC = txtSVC
rst!WORK_SEC = txtWORK_SEC
rst!WT = txtWT
rst.Update
rst.Closerst.Open “tblAddresses”, cnn, adOpenKeyset, adLockOptimistic, adCmdTableDirect
rst.AddNew
rst!Ssn = txtSSN
rst!CELL_PHONE = txtCELL_PHONE
rst!FATHER_ADDRESS = txtFATHER_ADDRESS
rst!FATHER_CITY_STATE_ZIP = txtFATHER_CITY_STATE_ZIP
rst!FATHER_NAME = txtFATHER_NAME
rst!FATHER_PHONE = txtFATHER_PHONE
rst!HOME_ADDRESS = txtHOME_ADDRESS
rst!HOME_CITY_STATE_ZIP = txtHOME_CITY_STATE_ZIP
rst!HOME_PHONE = txtHOME_PHONE
rst!MARRIED = txtMARRIED
rst!MOTHER_ADDRESS = txtMOTHER_ADDRESS
rst!MOTHER_CITY_STATE_ZIP = txtMOTHER_CITY_STATE_ZIP
rst!MOTHER_NAME = txtMOTHER_NAME
rst!MOTHER_PHONE = txtMOTHER_PHONE
rst!NOK_ADDRESS = txtNOK_ADDRESS
rst!NOK_CITY_STATE_ZIP = txtNOK_CITY_STATE_ZIP
rst!NOK_NAME = txtNOK_NAME
rst!NOK_PHONE = txtNOK_PHONE
rst!NOK_RELATION = txtNOK_RELATION
rst!NUMBER_OF_DEPENDENTS = txtNUMBER_OF_DEPENDENTS
rst!SPOUSE_ADDRESS = txtSPOUSE_ADDRESS
rst!SPOUSE_CITY_STATE_ZIP = txtSPOUSE_CITY_STATE_ZIP
rst!SPOUSE_NAME = txtSPOUSE_NAME
rst!SPOUSE_PHONE = txtSPOUSE_PHONE
rst!WORK_PHONE = txtWORK_PHONE
rst.Update
rst.Closerst.Open “tblPersonalInfo”, cnn, adOpenKeyset, adLockOptimistic, adCmdTableDirect
rst.AddNew
rst!Ssn = txtSSN
rst!HMMWV_LICENSE = chkHMMWV_LICENSE
rst!BOOT = txtBOOT
rst!CLEARANCE_DATE = txtCLEARANCE_DATE
rst!FLAK = txtFLAK
rst!GAS_MASK = txtGAS_MASK
rst!GORETEX_BOTTOM = txtGORETEX_BOTTOM
rst!GORETEX_GLOVE = txtGORETEX_GLOVE
rst!GORETEX_TOP = txtGORETEX_TOP
rst!HELMET = txtHELMET
rst!JACKET = txtJACKET
rst!SAPI = txtSAPI
rst!SECURITY_CLEARANCE = txtSECURITY_CLEARANCE
rst!TROUSER = txtTROUSER
rst.Update
rst.CloseExitHandler:
On Error Resume Next
rst.Close
Set rst = Nothing
Set cnn = Nothing
Exit SubErrHandler:
MsgBox Err.Description, vbExclamation
Resume ExitHandler
End Sub_____________________________
‘Check the SSN field to make sure data is correct
‘If data doesn’t meet criteria, go back to SSN field
‘and let the data entry clerk know where they messed up
Private Sub txtMOS_Enter()
If Len(Me.txtSSN) 10 Then
MsgBox “Enter 10 digit SSN”, vbExclamation
Me.txtSSN.SetFocus
End IfEnd Sub
_____________________________
‘Takes for granted most common data entry error
‘Adds a zero in front of a 9 digit SSNPrivate Sub txtSSN_AfterUpdate()
If Len(Me.txtSSN) = 9 Then
Me.txtSSN = “0” & Me.txtSSN
End If
End Sub -
WSHansV
AskWoody Lounger -
WSNYIntensity
AskWoody Lounger -
WSFrancois
AskWoody Lounger -
WSNYIntensity
AskWoody Lounger -
WSFrancois
AskWoody Lounger
-
-
-
-
WSNYIntensity
AskWoody Lounger-
WSSupport4John
AskWoody Lounger -
WSNYIntensity
AskWoody Lounger
-
Viewing 1 reply thread -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
Windows 11 24H2 Default Apps stuck on Edge and Adobe Photoshop
by
MikeBravo
15 minutes ago -
North Face and Cartier customer data stolen in cyber attacks
by
Alex5723
39 minutes ago -
What is wrong with simple approach?
by
WSSpoke36
2 hours, 15 minutes ago -
Microsoft-Backed Builder.ai Set for Bankruptcy After Cash Seized
by
Alex5723
8 hours, 43 minutes ago -
Location, location, location
by
Susan Bradley
27 minutes ago -
Cannot get a task to run a restore point
by
CWBillow
10 hours, 9 minutes ago -
Frustrating search behavior with Outlook
by
MrJimPhelps
53 minutes ago -
June 2025 Office non-Security Updates
by
PKCano
20 hours, 54 minutes ago -
Secure Boot Update Fails after KB5058405 Installed
by
SteveIT
2 hours, 58 minutes ago -
Firefox Red Panda Fun Stuff
by
Lars220
20 hours, 51 minutes ago -
How start headers and page numbers on page 3?
by
Davidhs
1 day, 7 hours ago -
Attack on LexisNexis Risk Solutions exposes data on 300k +
by
Nibbled To Death By Ducks
9 hours, 57 minutes ago -
Windows 11 Insider Preview build 26200.5622 released to DEV
by
joep517
1 day, 15 hours ago -
Windows 11 Insider Preview build 26120.4230 (24H2) released to BETA
by
joep517
1 day, 15 hours ago -
MS Excel 2019 Now Prompts to Back Up With OneDrive
by
lmacri
1 day, 5 hours ago -
Firefox 139
by
Charlie
22 hours, 14 minutes ago -
Who knows what?
by
Will Fastie
36 minutes ago -
My top ten underappreciated features in Office
by
Peter Deegan
1 day, 16 hours ago -
WAU Manager — It’s your computer, you are in charge!
by
Deanna McElveen
1 day, 11 hours ago -
Misbehaving devices
by
Susan Bradley
12 hours, 24 minutes ago -
.NET 8.0 Desktop Runtime (v8.0.16) – Windows x86 Installer
by
WSmeyerbos
2 days, 22 hours ago -
Neowin poll : What do you plan to do on Windows 10 EOS
by
Alex5723
1 hour, 17 minutes ago -
May 31, 2025—KB5062170 (OS Builds 22621.5415 and 22631.5415 Out-of-band
by
Alex5723
2 days, 21 hours ago -
Discover the Best AI Tools for Everything
by
Alex5723
1 day, 20 hours ago -
Edge Seems To Be Gaining Weight
by
bbearren
2 days, 11 hours ago -
Rufus is available from the MSFT Store
by
PL1
2 days, 19 hours ago -
Microsoft : Ending USB-C® Port Confusion
by
Alex5723
3 days, 22 hours ago -
KB5061768 update for Intel vPro processor
by
drmark
1 day, 22 hours ago -
Outlook 365 classic has exhausted all shared resources
by
drmark
1 day, 20 hours ago -
My Simple Word 2010 Macro Is Not Working
by
mbennett555
3 days, 18 hours ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.