-
WSPaulK
AskWoody LoungerGreat! I had been mislead to believe they were interchangeable. Thanks for the correction.
Your code was very enlightening as well. I particularly like your commenting style. It makes for very readable code.
Should this line:
strSQL = BuildInsertSQL(ctl, NewData)
Read:
strSQL = BuildInsertSQL(ctl, strTbl, NewData)
or have I missed something again?
-
WSPaulK
AskWoody LoungerGlad to hear you got it all sorted out!
-
WSPaulK
AskWoody LoungerWhat is the name of the control on your report? If it is the same as the underlying field then try changing the name of the control to some thing different and then change your code accordingly.
-
WSPaulK
AskWoody LoungerOnly other thing I can think of is what Rory suggested – the back style….my experiments with your code are working.
-
WSPaulK
AskWoody LoungerWhen you say “it doesn’t work” what results are you getting exactly?
-
WSPaulK
AskWoody LoungerOne thing I notice is that you have quotes around some values in your if…then statements but not around others. is the value in docstatus text?
-
WSPaulK
AskWoody LoungerThis could be done a couple of ways. I’d first try a parameter query which would reference the control values on your popup form in the criteria row or where clause of the queries on which your reports are based. Once the form is created use the expression builder to get the correct syntax for referring to the form controls in your queries. As for the date range you can use the Between…And expression in the criteria row or where clause as well.
Select * From tblWorkFlow
Where [FacilityID] = [Forms]![FromName]![FormControlName] AND [ProductionDate] Between [Forms]![FormName]![Date1ControlName] And [Forms]![FormName]![Date2ControlName]As for opening the selected report in the click event of your “OK” button use the openform method and substitute the control name for the report name argument:
DoCmd.OpenReport Me.ControlName
-
WSPaulK
AskWoody LoungerIs the id field the primary key for the employee table? You should be able to use the lookup wizard in the second table to create a link between the two tables with the primary key field hidden. Here’s how the properties should look for your lookup field in the lookup tab:
Display Control=Combo Box
Row Source Type=Table/Query
Row Source=Your SQL Statement
Bound Column=2 or whichever one is the ID
Column Count=2
Column Heads=No
Column Widths=1″;0″Default the rest
-
WSPaulK
AskWoody LoungerI prefer to use the enabled property of controls rather than the visible property. Since the company option is the default selection set the enabled property of the individual controls to false. Then in the after update event of the option group use an if…then or select case statement to set the properties of the appropriate controls. Something like this:
Const conCompany as Integer = 1
Const conIndividual as Integer = 2Select Case optAddressType ‘ Name of your option group
Case conCompany
Me.txtIndividualFirstName.Enabled = False
Me.txtcompanyName.Enabled = True
Case conIndividual
Me.txtIndividualFirstName.Enabled = True
Me.txtcompanyName.Enabled = False
End SelectYou will also need a similar statement in the form’s current event in which case you might want to put the const statements in the form module declarations section.
-
WSPaulK
AskWoody LoungerThe point I was trying to make was that after you prompt the user to confirm they want to add a member to the list it is not required that you open a form since the only variable data you are storing is the vendor name, which is contained in the NewData argument. The rest is an autonumber and the date which can be handled in the Default Value property of the field in table design. Below is a modified version of your original notinlist event. Please post back with any questions.
Private Sub VendorID_NotInList(NewData As String, Response As Integer)
Dim rst As DAO.Recordset
Dim db As DAO.DATABASE
Dim strMsg as StringOn Local Error GoTo ErrorHandler
strMsg = “This vendor ” & NewData & ” is not in the list. Do you want to add it?”
If MsgBox(strMsg, vbQuestion + vbYesNo, “New Vendor”)= vbYes Then
Set rst = db.OpenRecordset(“YourTableName”)
With rst
.AddNew
!VendorName = NewData
.Update
End With
Response = acDataErrAdded
Else
Response = acDataErrContinue
End IfExitProc:
rst.Close
Set dbs = Nothing
Set rst = Nothing
Exit SubErrorHandler:
Select Case Err
Case Else
strMsg = “Error Information…” & vbCrLf & vbCrLf
strMsg = strMsg & “Sub: VendorID_NotInList” & vbCrLf
strMsg = strMsg & “Description: ” & Err.Description & vbCrLf
strMsg = strMsg & “Error #: ” & Format$(Err.Number) & vbCrLf
MsgBox strMsg, vbInformation, “VendorID_NotInList”
Response = acDataErrContinue
Resume ExitProc
End SelectEnd Sub
You will need to open the vendor table in design mode and set the Default Value of the date field to Date(). This will set this field to the system date of the pc when a new record is added.
If you prefer to use the form make sure the form is bound to the vendor table or a query based on the vendor table.
-
WSPaulK
AskWoody LoungerThough I’m not as familiar with ADO I believe it is just a matter of changing the type of objects (db,rst) from DAO to ADO. One thing I left out was to destroy the objects at the end of the procedure. I’ll try and modify the post to reflect this oversight on my part.
-
WSPaulK
AskWoody LoungerI’ve had to import Word documents before but usually from tables in Word. The technique usually involved using the find and replace feature of Word to place some delimiting character between fields and records. Then saving the doc as text and importing into Excel or Access. You might be able to use a similar technique if your docs have a repeating structure of some kind.
-
WSPaulK
AskWoody LoungerIf you want to just display the built in progress bar for your query go back into the startup options and check the box next to Display Status Bar.
-
WSPaulK
AskWoody LoungerIf I understand you correctly you are storing the vendor name and date the record is created plus an autonumber for the vendorID? If this is so you really don’t need the form at all. You could open the vendor table through dao or ado and use the addnew method to create a new record setting the vendor name field to the NewData argument and the Date field to Date(). The atonumber ID field should update automatically when you use the update method. Then set the response argument to acDataErrAdded. This lets Access know a new item has been added to the combobox’s underlying recordset and to requery the list. If this isn’t happening double check the row source of your combobox. Good luck!!
-
WSPaulK
AskWoody LoungerThe only other difference between text and memo besides the maximum number of characters that can be stored in each – text=255, memo=64k – is that you cannot index or sort a memo field. Depending on the maximum length in your description field you could try splitting it into two text fields and then concatenate them for queries and reports. This can present its own problems however.
![]() |
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 |

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
-
Ubuntu 25.04 (Plucky Puffin) Beta released
by
Alex5723
3 hours, 24 minutes ago -
How to install App Store apps on an external SSD
by
Alex5723
4 hours, 17 minutes ago -
Where is Windows going?
by
Susan Bradley
5 hours, 35 minutes ago -
Does anyone know how can we convert OST to Office 365? (Awaiting moderation)
by
Sanchit Tandon
8 hours, 2 minutes ago -
Installing Feature Update Windows 11 24H2
by
geekdom
21 hours, 46 minutes ago -
Windows 11 Insider Preview build 27823 released to Canary
by
joep517
22 hours, 10 minutes ago -
Windows 11 Hotpatch
by
Hackmuss
5 hours, 28 minutes ago -
System Guard service error still won’t be fixed
by
Susan Bradley
22 hours, 49 minutes ago -
Operation ForumTroll: APT attack with Google Chrome zero-day exploit chain
by
Alex5723
17 hours ago -
Troy Hunt of HaveIBeenPwned Phished
by
Lars220
14 hours, 1 minute ago -
Microsoft Windows security auditing Code 5061
by
mpw
1 day, 11 hours ago -
Can’t display images in incoming Outlook 365 emails
by
WScopwriter
18 hours, 58 minutes ago -
Windows 11 Insider Preview Build 26200.5510 early builds of 25H2
by
Alex5723
20 hours, 26 minutes ago -
0Patch : Micropatches released for SCF File NTLM Hash Disclosure Vulnerability
by
Alex5723
19 hours, 55 minutes ago -
Select multiple emails and they all open up!
by
CeeJay
2 days, 12 hours ago -
How to remove an update preview
by
Gunny
15 hours, 19 minutes ago -
Third party add ins reminder
by
Susan Bradley
13 minutes ago -
OTF, which backs Tor, Let’s Encrypt and more, sues to save its funding
by
Nibbled To Death By Ducks
2 days, 6 hours ago -
Updating Windows 10 to Windows 11: 23H2 or 24H2?
by
Still Anonymous
2 days, 16 hours ago -
How can I update “Explorer Patcher”
by
WSplanckster
2 days, 18 hours ago -
Check out the home page for Signal
by
CAS
2 days, 16 hours ago -
Windows 11 and Trial version of MS Office
by
Tex265
2 days, 15 hours ago -
Windows 11 Insider Preview build 26120.3585 (24H2) released to BETA
by
joep517
2 days, 23 hours ago -
Windows 11 Insider Preview build 26200.5510 released to DEV
by
joep517
2 days, 23 hours ago -
Windows 11 Insider Preview Build 26100.3624 (24H2) released to Release Preview
by
joep517
2 days, 23 hours ago -
Limits on User Names
by
CWBillow
2 days, 20 hours ago -
MS-DEFCON 4: Mixed bag for March
by
Susan Bradley
20 hours, 1 minute ago -
Non Apple Keyboards
by
pmcjr6142
21 hours, 17 minutes ago -
How to delete your 23andMe data – The Verge
by
AJNorth
2 days, 17 hours ago -
7 common myths about Windows 11 (Microsoft AD)
by
EyesOnWindows
2 days, 15 hours ago
Recent blog posts
- Where is Windows going?
- System Guard service error still won’t be fixed
- Third party add ins reminder
- MS-DEFCON 4: Mixed bag for March
- Classic and Extended Control Panel — no need to say goodbye
- Things you can do in 2025 that you couldn’t do in 2024
- Revisiting Windows 11’s File Explorer
- Planning ahead for migration
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.