Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

My code Can't find a Table I KNOW is There!! Help? 1

Status
Not open for further replies.

Nelz

Programmer
Sep 27, 2001
50
US
Im using this code to update a bunch of records on multiple tables. They're all visible on open forms and sub forms. The last one in the statement - "EmbroideryDetails" was originally on a tab - and the code broke saying "Can't find the Form EmbroideryDetails" . I tried just for the heck of it taking it off the tab...but it still can't find it. The rest of the code works GREAT. What am I doing wrong? I feel like I'm making a stupid mistake I can't see. Here's the code so far..... Thank you SO MUCH!!!!!

Private Sub ReOrder_Click()

Dim db As Database
Dim rs As Recordset
Dim num As Long

Set db = CurrentDb
Set rs = db.OpenRecordset("Orders")

With rs
.AddNew
num = !OrderID
!CustomerID = Forms![Orders].CustomerID
!FreightCharge = Forms![Orders].FreightCharge
!OrderDate = Date
!EmployeeID = 1
!PurchaseOrderNumber = Forms![Orders].PurchaseOrderNumber
!SalesTaxRate = Forms![Orders].SalesTaxRate
!RefOrderID = Forms![Orders].OrderID
.Update
End With

Set rs = db.OpenRecordset("Order Details")

With rs
.AddNew
!OrderID = num
!Quantity = Me.Quantity
!UnitPrice = Me.UnitPrice
!Discount = Me.Discount
!setupcharge = Me.setupcharge
!RushCharge = Me.RushCharge
!Description = Me.Description

.Update
End With

Set rs = db.OpenRecordset("EmbroideryDetails")

With rs
.AddNew
!OrderID = num
!UV = Forms![EmbroideryDetails].UV

.Update
End With

db.Close

End Sub
 
Can't say I understand what you're doing, but if you want to refer to a subform, don't you have to include the name of the Main form in the reference?
 
I guess you're right...I tried
Forms![Orders]![EmbroideryDetails].UV
...but i got the error message "Doesnt support this object or method....

I really think it's something stupid like you suggest. I guess I'll just have to try every variable I can think of...unless you can see it...Thanks for answering though...I'll work under the assumption that that is my mistake...
 
OK....you were right...i had the syntax wrong. I used
!UV = Forms!Orders!EmbroideryDetails.Form!UV
and it worked. I considered myself to be fairly knowledgable about using Access. I primarily write code and design websites. This is so different it takes me a while to remember all the nuances. Thank you to all of you on this posting who give your time and energy to help people like me.

Certainly makes me happy to know that people like us like to hekp each other.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top