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, but widespread attacks make patching prudent. Go ahead and patch, but watch out for potential problems. |
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, 10 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
-
AugLoop.All (TEST Augmentation Loop MSIT)
by
LarryK
4 hours, 17 minutes ago -
Boot Sequence for Dell Optiplex 7070 Tower
by
Serge Carniol
9 hours, 21 minutes ago -
OTT Upgrade Windows 11 to 24H2 on Unsupported Hardware
by
bbearren
12 hours, 54 minutes ago -
Inetpub can be tricked
by
Susan Bradley
14 hours, 13 minutes ago -
How merge Outlook 2016 .pst file w/into newly created Outlook 2024 install .pst?
by
Tex265
10 hours, 59 minutes ago -
FBI 2024 Internet Crime Report
by
Alex5723
16 hours, 43 minutes ago -
Perplexity CEO says its browser will track everything users do online
by
Alex5723
4 hours, 30 minutes ago -
Login issues with Windows Hello
by
CWBillow
1 day, 3 hours ago -
How to get into a manual setup screen in 2024 Outlook classic?
by
Tex265
15 hours, 43 minutes ago -
Linux : ARMO rootkit “Curing”
by
Alex5723
1 day, 15 hours ago -
Employee monitoring app leaks 21 million screenshots in real time
by
Alex5723
1 day, 15 hours ago -
Google AI is now hallucinating idioms
by
Alex5723
1 day, 15 hours ago -
april update
by
69800
18 hours, 11 minutes ago -
Windows 11 Insider Preview build 27842 released to Canary
by
joep517
1 day, 16 hours ago -
Quick Fix for Slowing File Explorer
by
Drcard:))
1 day, 17 hours ago -
WuMgr not loading?
by
LHiggins
12 hours, 51 minutes ago -
Word crashes when accessing Help
by
CWBillow
21 hours, 11 minutes ago -
New Microsoft Nag — Danger! Danger! sign-in to your Microsoft Account
by
EricB
1 day, 16 hours ago -
Blank Inetpub folder
by
Susan Bradley
1 day, 14 hours ago -
Google : Extended Repair Program for Pixel 7a
by
Alex5723
2 days, 3 hours ago -
Updates seem to have broken Microsoft Edge
by
rebop2020
1 day, 13 hours ago -
Wait command?
by
CWBillow
1 day, 20 hours ago -
Malwarebytes 5 Free version manual platform updates
by
Bob99
2 days, 9 hours ago -
inetpub : Microsoft’s patch for CVE-2025–21204 introduces vulnerability
by
Alex5723
2 days, 16 hours ago -
Windows 10 finally gets fix
by
Susan Bradley
3 days, 1 hour ago -
AMD Ryzen™ Chipset Driver Release Notes 7.04.09.545
by
Alex5723
3 days, 2 hours ago -
How to use Skype after May?
by
Joann
1 day, 11 hours ago -
Win 7 MS Essentials suddenly not showing number of items scanned.
by
Oldtimer
2 days, 21 hours ago -
France : A law requiring messaging apps to implement a backdoor ..
by
Alex5723
3 days, 15 hours ago -
Dev runs Windows 11 ARM on an iPad Air M2
by
Alex5723
3 days, 16 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.