I'm kind of doubling up on my example. Maybe it's not that useful, but ehre's the code for how I check to see if a table exists or not and then delete it if it does:
Private Sub CheckExists(strTableName As Sring)
' check to see if the table exists, if it does then delete it since the next step...
This is the code that I copied from somewhere
Dim dbClient As Database
Dim tdf As TableDef
Set dbClient = CurrentDb
For Each tdf In dbClient.TableDefs
If tdf.Name = strTableName Then
DoCmd.DeleteObject acTable, strTableName
Exit Sub
End If
Next
You could monkey with the test on...
You might try setting the format proerty for the field, both in the table and on the form unless you delete and re-add the field.
For a 5 position numeric field, the format property would be 00000 if you want leading zeros.
Denny
Check the data type on the ClientId in your table. Perhaps it's a number, in which case you wouldn't want the single quotes around the txtIDField like I recommended.
Maybe your problem was just having the parentheses included in your original statement. Eveything else in your original code...
I assume that ClientID is a text field, in that case your string should read as follows:
"[DomainType] = 'P' And [ClientID] = '" & txtClientID & "'"
You need to imbed single quotes around txtClientID (if ClientID is a text field) and you shouldn't have parentheseis around the string (at least...
1. Set up a calculated field in yur query
Year: Year(datefield)
enter the paramater prompt under this field.
2. Set up a calculated field in your query
PresentCount: iif(PresentField = "Present",1,0)
sum this guy and you'll have your count.
Denny
I base almost all of my reports off of queries. In that situation, I build the parameter prompt there:
In the Criteria section of the grid:
Between [Enter Start Date] and [Enter End Date]
It's a little friendlier to front-end this with a form but the papramter prompts aren't the worst thing...
I wonder if an alternative approach would be to use the command button wizard to add an Add New Record button on the subform. That should cause the subform to add the record and clear the form for the next input.
I know it doesn't leave the button where you would like to place it but I don't...
1. Change the Cycle Property of the Form (listed under the Other Tab) to 1
This will cause the focus to shift back to the first field after the user tabs through the last field.
2. Use the Command Button Wizard to add a button for Adding a New Record. Once that is setup when the user clicks...
the way I do this is to use the date fields on the form as parameters in the query that is the recordsource for the report.
if we assume that your form, Form1, has two input fields: txtDate1 and txtDate2
in the query used for the report have the following criteria under the date field...
On thing you could consider is moving the statement where you set the caption value to the OnOpen event in the report
Me.lblDetail.Caption = me.sDetail
This requires that sDetail (or some synonymous field) needs to be on your report,perhaps as an Invisible control. That may not be possible in...
if you base your report on a query you could set up a calculated field that would do this:
RejCount:iif([RejQty] > 0,1,0)
you would then add RejCount to your report and sum that column to get the total.
Denny
You need to append the records to a cumulative table each time you download to Access. It sounds like you currently are creating a new table each time and appending only the records for that time period. You coudl continue to do that but you would also need to append the data to your...
I don't use the DoCmd statement but here's how I automate my parameter queries:
Dim dbClient As Database
Dim qdf As QueryDef
Set dbClient = CurrentDb
Set qdf = dbClient.QueryDefs("Query1")
qdf.Parameters![Year Month] = rs("YRMTH")
qdf.Execute
where [Year Month] is the paramater in my...
Add a caclulated field to your query:
Month:month(DateField)
Then in your report make this new field one of your grouping fields with a footer. You add the sub-total fields in the Footer section. You can also chnage the Format Property for the Footer to Force New Page: After section
Denny
You might be able to do something with VBA code in the OnPrint Event, i.e. maintain your own variable and increment it on every record. Just an idea, not necessarilly a practical one.
Denny
This looks like you're involved in the human genome project. Perhaps you'll uncover an Access gene.
to fill the length field, use code in the AfterUpdate Event for the field where you're entering the content:
me.LengthField = len(me.ContentField)
The other problem is a little more...
you could try setting a variable in the OnPrint event for the Detail Section:
TotField = TotField + me.Field1
then set use this value in the OnPrint event of the Report Footer:
me.TotAmount = Totfield
I can't say that I've gotten this to work exactly but I think it has some potential. You...
CLNG doesn't always seem to round the same way, e.g. Clng(3.5) and Clng(4.5) both seem to give you 4.
I use:
Field1= int(field2*100+.5)/100
That works most of the time for me, though there may be easier/better approaches.
Denny