I thank you for all your help. But I just found that we're not done: my dup edit works too well. I get the dup error message on any new record I try to add, even if it is not a duplicate.
In my BeforeUpdate procedure I have a series of required field edits, which is followed now by the new...
Hooray! It works!
One little thing: all the data entered on the form is blanked out when the error appears. This is desired when it fails any of the other edits in this procedure, but I'd like the data to stay on the form for just this one. How can I do this?
Dim db As DAO.Database, rst As DAO.Recordset
Dim strMsg As String, Style As Integer, Title As String
If (Len(Me!ContactLastName & "") > 0) And _
(Len(Me!CompanyName & "") > 0) Then
Set db = CurrentDb()
Set rst = db.OpenRecordset("Customers", dbOpenDynaset)...
My table has two fields used as the key, ContactLastName and CompanyName. If the user attempts to add a duplicate record using my form I would like a custom error message to display and the record not added to the table.
I tried following advice given for a previously asked question in this...
Thanks for hanging in there with me. We would always want to add the record, and would sometimes want to print it.
The report I wrote prints a record in the table; when designing it I did not see a way to print it from the form before adding it to the table. So that implies the record must be...
I saw this from someone's previous question and tried it but had trouble with it. Can I only print the record after it has been written to the table? Please look at my question again to help me understand this.
Thank you
My Customer form has an "Add Record" button that writes the new record to the table. I would like the user to have the option of just adding it or adding and printing that current record (and not all the records that have been previously written). What is the best way to handle this?
My "Add...
I have a form with an "Add Record" button. We want to print the contents of the form from the current record before adding it to the table. When I write a report to print the current record and invoke it by clicking a print button, it can't find the record because it hasn't been written to the...
Here is my Add Record code:
Private Sub Add_Record_Click()
On Error GoTo Err_Add_Record_Click
DoCmd.GoToRecord , , acNewRec
Exit_Add_Record_Click:
Exit Sub
Err_Add_Record_Click:
MsgBox Err.Description
Resume Exit_Add_Record_Click
End Sub
Thanks!
PH:
I tried your suggestion and still got the same results. First I get my good error message "Missing data...", but then I also get the "Can't go to specified record", then I can enter the req'd data.
his is what my code looks like:
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim booOkay...
Willir,
Thanks so much. That worked beautifully. Two things, though: (1) my custom message appears, I click OK, and a second error message "You can't go to the specified record" opens. I click OK and I can then enter the required field. How do we stop the second message from appearing? (2) I...
I have a simple form for a simple table. The first several fields are required, which I did at the table level. I have 2 problems: (1) If I do not enter all the req'd fields and click my "Add Record" control button, I get the error "You can't go to the specified record". I would prefer to...
Wonderful! I did exactly as you outlined and it works beautifully. Thank you so much.
Just one minor snag: if there are no Purchase records (and, hence, no purchase qty) for a part number, when I subtract purchases from counted qty to get my current inventory level by using =[Qty On...
I'm trying to create a report that shows a manager's beginning budget in the group header, purchases against the budget in detail lines, and then ending budget balance in the group footer. The data is from a query, which includes a calculated cost value of each purchase of Expr2...
I have an Inventory table which contains partno, inventorycount, and countdate from the last physical inventory taken. I also have a Purchases table, which contains partno (same as in Inventory table), purchaseqty, and purchasedate.
I want to create a report that shows my current inventory...
Thanks so much. That did it.
But now I have the same problem with a percentage calculation on those fields. This is what I have (using my old abs(sum) expression):
=Abs(Sum([fldname1]="Y"))/Abs(Sum([fldname2] Is Not Null))
where fldname1=0, fldname2=1.
Sometimes the zero result of...
In order to show only counts I have a report which displays only a group footer and page footer. One field in the group footer counts the number of times a field equals a given value. I am using the =abs(sum{fldname]="X")) expression. When the group count equals zero, on some lines it...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.