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?
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
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 20 years 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
-
I set up passkeys for my Microsoft account
by
Lance Whitney
22 minutes ago -
AI is for everyone
by
Peter Deegan
4 hours, 41 minutes ago -
Terabyte update 2025
by
Will Fastie
4 hours, 42 minutes ago -
Migrating from Windows 10 to Windows 11
by
Susan Bradley
5 hours, 3 minutes ago -
Lost sound after the upgrade to 24H2?
by
Susan Bradley
14 hours, 45 minutes ago -
How to move 10GB of data in C:\ProgramData\Package Cache ?
by
Alex5723
3 hours, 15 minutes ago -
Plugged in 24-7
by
CWBillow
42 minutes ago -
Netflix, Apple, BofA websites hijacked with fake help-desk numbers
by
Nibbled To Death By Ducks
1 day, 3 hours ago -
Have Copilot there but not taking over the screen in Word
by
CWBillow
1 day, 1 hour ago -
Windows 11 blocks Chrome 137.0.7151.68, 137.0.7151.69
by
Alex5723
2 days, 19 hours ago -
Are Macs immune?
by
Susan Bradley
17 hours, 5 minutes ago -
HP Envy and the Function keys
by
CWBillow
2 days, 2 hours ago -
Microsoft : Removal of unwanted drivers from Windows Update
by
Alex5723
6 hours, 35 minutes ago -
MacOS 26 beta 1 dropped support for Firewire 400/800
by
Alex5723
3 days, 6 hours ago -
Unable to update to version 22h2
by
04om
14 hours, 48 minutes ago -
Windows 11 Insider Preview Build 26100.4482 (24H2) released to Release Preview
by
joep517
3 days, 14 hours ago -
Windows 11 Insider Preview build 27881 released to Canary
by
joep517
3 days, 14 hours ago -
Very Quarrelsome Taskbar!
by
CWBillow
2 days, 23 hours ago -
Move OneNote Notebook OFF OneDrive and make it local
by
CWBillow
4 days, 3 hours ago -
Microsoft 365 to block file access via legacy auth protocols by default
by
Alex5723
3 days, 15 hours ago -
Is your battery draining?
by
Susan Bradley
15 hours, 25 minutes ago -
The 16-billion-record data breach that no one’s ever heard of
by
Alex5723
15 hours, 26 minutes ago -
Weasel Words Rule Too Many Data Breach Notifications
by
Nibbled To Death By Ducks
4 days, 6 hours ago -
Windows Command Prompt and Powershell will not open as Administrator
by
Gordski
9 hours, 11 minutes ago -
Intel Management Engine (Intel ME) Security Issue
by
PL1
3 days, 15 hours ago -
Old Geek Forced to Update. Buy a Win 11 PC? Yikes! How do I cope?
by
RonE22
3 days, 7 hours ago -
National scam day
by
Susan Bradley
2 days, 14 hours ago -
macOS Tahoe 26 the end of the road for Intel Macs, OCLP, Hackintosh
by
Alex5723
3 days, 10 hours ago -
Cyberattack on some Washington Post journalists’ email accounts
by
Bob99
5 days, 7 hours ago -
Tools to support internet discussions
by
Kathy Stevens
3 days, 20 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.