-
WSRonM
AskWoody LoungerThe two query program in the event procedure worked PERFECTLY!!! Tested it over and over again. I am one happy camper and will put the Excedrin away. Thanks again!
Will probably return with my next dilemma.
-
WSRonM
AskWoody LoungerfldNotTaxable is not a control on the form. I am going to try to simplify this whole thing and disregard all previous discussion. As an example, I have just run a query “qryA” that returns one record with two fields: [fldWOnum], the workorder number; and [fldNotTaxable], a yes/no field. What I want to do is: If the [fldNotTaxable] is “yes”, I want to run another query, “qryNoTax”. If the [fldNotTaxable] is “no”, I want to run a query, “qryWithTax”. I am trying to accomplish this with an If…Then…Else within an event procedure. Might there be an easier way to accomplish this?
-
WSRonM
AskWoody LoungerThe “qryPrintOneWO” ties together the workorder number with its basic information – registration # – customer number – date started – date finished – labor rate – work description – and if the workorder is taxable. Then via relationship, the registration # gets the appropriate details from the aircraft table – make – model – serial number. Also it is related to the customer table with the customer number to get the company name – address – notes – etc. It is the source for the report that is generated. I was hoping that I could also use it to feed the information to the summary table which is the first subreport on the main report.
-
WSRonM
AskWoody LoungerActually the two queries, “qryUpdateSummaryTable” & “qryUpdateSummaryTableNoTax” are update queries that send all the different dollar totals for the one workorder to a summary table. This summary table is then used through a query to provide information to one of the 4 subreports of the main report (& not a part of the event procedure). The following is the event procedure with comments.
Private Sub Command3_Click()
Dim Db As Database
Dim rs As Recordset
Set Db = CurrentDb
Set rs = Db.OpenRecordset(“tblBatchWO”)
‘the form, “frmPrintWO” is used to enter the workorder numbers
‘in the “fldWONUM” of the “tblBatchWO”Do
If rs.RecordCount = 0 Then
Exit Do
Else
DoCmd.SetWarnings False
‘take the first wo number and append it
‘to the tblWOnumber table
DoCmd.OpenQuery “qryApnd1toWOnum”‘evaluate taxable or not
DoCmd.OpenQuery “qryPrintOneWO”
‘the “qryPrintOneWO” contains the yes/no field, “fldNotTaxable”
‘the next If…Then…Else should update the Summary tableIf “fldNotTaxable” Then ‘this line does not work. It comes
‘back with a run time error 13 – type mismatch. This is the
‘place where I am totally lost. The two following queries work
‘just fine if I process them manually
DoCmd.OpenQuery “qryUpdateSummaryTable”
DoCmd.Requery
Else
DoCmd.OpenQuery “qryUpdateSummaryTableNoTax”
DoCmd.Requery
End If‘now print a workorder
DoCmd.OpenReport “rptPrintOneWO”, acViewNormal
‘now delete the w.o. number just printed
‘and the corresponding w.o. number in Batch
DoCmd.OpenQuery “qryDel1fromBatchAndWO”
‘now requery the subform
DoCmd.Requery “frmPrintWOsubform”
End If
Loop While rs.RecordCount > 0Set Db = Nothing
Set rs = NothingEnd Sub
-
WSRonM
AskWoody LoungerI tried your VBA code and it came back with – compile error – variable not defined. A further explanation of what I am doing is this: From a one field form the user can enter many different workorder numbers – – when a command button is pressed the workorder numbers are processed one at a time and printed with a Do…Loop. Within this Do…Loop, I want to evaluate whether the workorder is taxable or not taxable (this taxable yes/no field is within each workorder number record has been pre selected for each workorder number). With one query, it will print the workorder with tax and the other query will print it without tax. The Do…Loop works just fine. The method that is used for processing one at a time is: AppendQuery, SELECT TOP1 to a table and then process it – when done, delete that record. I have much difficulty understanding Dim, Set and variables. I have been looking at many error messages; variable not defined, object required, keyword not found, etc., etc. The help information is leaving me confused.
-
WSRonM
AskWoody LoungerSometimes I think that people try to make things a lot more difficult than they need to be. I stepped back and looked at what I was trying to achieve with my limited programming abilities. I tried to do it with relatively simple queries. Sure enough, I got just what I needed with one append and two delete queries. Worked the SQLs into the Do/Loop and If/Then statements and got just what I needed. Thanks for politely reminding me to refocus.
-
WSRonM
AskWoody LoungerThanks for your assistance and patience. Quite often what a person is thinking and what they said are not properly communicated or understood by another. It is now closer to what I want. Thank you again for your help.
-
WSRonM
AskWoody LoungerReattach attachment
-
WSRonM
AskWoody LoungerI have attached a small database with two forms – Continuous & Datasheet. The words that I have entered further explain and show what I am trying to achieve.
-
WSRonM
AskWoody LoungerIs there any way to get into the inner workings of the system and figure out how Microsoft made it happen? What I am trying to accomplish is to duplicate the default cursor movement that occurs in datasheet view. Thanks.
-
WSRonM
AskWoody LoungerThank you!
-
WSRonM
AskWoody LoungerIt works just fine!
Thank you very much for your assistance.
You did it again.The malfunction was caused by the defect midway between my two ears. Under the Action Arguments I had typed: Function Name: InitApplication(). After removing the (Function Name:) it worked great.
You may now proceed to ROFL.
-
WSRonM
AskWoody LoungerThank you for any and all help provided.
First I must admit that I am not a programming guru.
Attempted to duplicate the KB article (Q245746). Everything was accepted by the program but It did not return the desired results. Went through the Step-by-Step Example on a copy of my program and when starting the program, was presented with the following message box:
(your program) can’t find the name ‘Function’ you entered in the expression.
You may have specified a control that wasn’t on the current object without specifying the correct form or report context.
To refer to a control on another form or report, precede the control name with the name of a collection, usually either Forms or Reports, and the name of the form or report to which the control belongs. For example, Forms![Products]![Units In Stock].
Was this example designed for A2000 and does not work on A97?
Was there an assumption of additional information that needs to be entered in order for the function to work?
I don’t know.Thanks again.
-
WSRonM
AskWoody LoungerGot the desired results from the table. You guys are great!!! Thanks a lot
. The more I learn, the more I realize how little I know.
-
WSRonM
AskWoody LoungerI entered the expression in the criteria for the query. Of the 2684 records in the table, the query only returned one record. That record was the only one that had 6 characters total in the field.
![]() |
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
-
184 MILLION Passwords on FBook, Google, MS & Netflix hacked/leaked
by
ClearThunder
1 hour, 8 minutes ago -
T-Mobile’s T-Life App has a “Screen Recording Tool” Turned on
by
Alex5723
1 hour, 23 minutes ago -
Windows 11 Insider Preview Build 26100.4202 (24H2) released to Release Preview
by
joep517
4 hours, 9 minutes ago -
Windows Update orchestration platform to update all software
by
Alex5723
8 hours, 42 minutes ago -
May preview updates
by
Susan Bradley
10 hours, 21 minutes ago -
Microsoft releases KB5061977 Windows 11 24H2, Server 2025 emergency out of band
by
Alex5723
10 hours, 28 minutes ago -
Just got this pop-up page while browsing
by
Alex5723
54 minutes ago -
KB5058379 / KB 5061768 Failures
by
crown
2 hours, 21 minutes ago -
Windows 10 23H2 Good to Update to ?
by
jkitc
30 minutes ago -
At last – installation of 24H2
by
Botswana12
1 day ago -
MS-DEFCON 4: As good as it gets
by
Susan Bradley
5 hours, 5 minutes ago -
RyTuneX optimize Windows 10/11 tool
by
Alex5723
1 day, 12 hours ago -
Can I just update from Win11 22H2 to 23H2?
by
Dave Easley
1 day, 5 hours ago -
Limited account permission error related to Windows Update
by
gtd12345
2 days, 1 hour ago -
Another test post
by
gtd12345
2 days, 2 hours ago -
Connect to someone else computer
by
wadeer
1 day, 20 hours ago -
Limit on User names?
by
CWBillow
1 day, 23 hours ago -
Choose the right apps for traveling
by
Peter Deegan
1 day, 13 hours ago -
BitLocker rears its head
by
Susan Bradley
21 hours, 27 minutes ago -
Who are you? (2025 edition)
by
Will Fastie
20 hours, 24 minutes ago -
AskWoody at the computer museum, round two
by
Will Fastie
1 day, 15 hours ago -
A smarter, simpler Firefox address bar
by
Alex5723
2 days, 12 hours ago -
Woody
by
Scott
2 days, 21 hours ago -
24H2 has suppressed my favoured spider
by
Davidhs
21 hours, 3 minutes ago -
GeForce RTX 5060 in certain motherboards could experience blank screens
by
Alex5723
3 days, 11 hours ago -
MS Office 365 Home on MAC
by
MickIver
3 days, 5 hours ago -
Google’s Veo3 video generator. Before you ask: yes, everything is AI here
by
Alex5723
4 days, 1 hour ago -
Flash Drive Eject Error for Still In Use
by
J9438
20 hours, 48 minutes ago -
Windows 11 Insider Preview build 27863 released to Canary
by
joep517
4 days, 20 hours ago -
Windows 11 Insider Preview build 26120.4161 (24H2) released to BETA
by
joep517
4 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.