Expected Sub error

E

EdwardA

While trying to update records using multiple append
queries, from one form and corresponding table, to another
form and corresponding table, I get the error Expected Sub
during the process of refreshing the form.

This is the code I have. I use the items serial number as
a display match, before deleting the row from the data
entry table. This is used to provide visual verification
that the item has indeed been updated.

Im sure its a simple enough solution, but I am not
grasping it.


Private Sub addinventory_Click()
On Error GoTo Err_addinventory_Click

Dim stDocName As String
Dim sdDocName As String
Dim seDocName As String
Dim sfDocName As String
Dim sgDocName As String
Dim sgLinkCriteria As String
Dim shDocName As String
Dim shLinkCriteria As String
Dim siDocName As String
Dim siLinkCriteria As String

RunCommand acCmdSelectAllRecords

stDocName = "STOCK_INC_WHSE27_Append"
DoCmd.OpenQuery stDocName, acNormal, acEdit

sdDocName = "STOCK_INC_REC_Append"
DoCmd.OpenQuery sdDocName, acNormal, acEdit

sgDocName = "STOCK_WHSE27"
sgLinkCriteria "[Serial Number]=" & "'" & Me![Serial
Number] & "'"
DoCmd.OpenForm sgDocName, , , sgLinkCriteria

seDocName = "STOCK_INC_Delete"
DoCmd.OpenQuery seDocName, acNormal, acEdit

sfDocName = "STOCK_Incoming"
DoCmd.OpenForm sfDocName, acNormal, acEdit

Exit_addinventory_Click:
Exit Sub

Err_addinventory_Click:
MsgBox Err.Description
Resume Exit_addinventory_Click

End Sub
 
D

Dirk Goldgar

EdwardA said:
While trying to update records using multiple append
queries, from one form and corresponding table, to another
form and corresponding table, I get the error Expected Sub
during the process of refreshing the form.

This is the code I have. I use the items serial number as
a display match, before deleting the row from the data
entry table. This is used to provide visual verification
that the item has indeed been updated.

Im sure its a simple enough solution, but I am not
grasping it.


Private Sub addinventory_Click()
On Error GoTo Err_addinventory_Click

Dim stDocName As String
Dim sdDocName As String
Dim seDocName As String
Dim sfDocName As String
Dim sgDocName As String
Dim sgLinkCriteria As String
Dim shDocName As String
Dim shLinkCriteria As String
Dim siDocName As String
Dim siLinkCriteria As String

RunCommand acCmdSelectAllRecords

stDocName = "STOCK_INC_WHSE27_Append"
DoCmd.OpenQuery stDocName, acNormal, acEdit

sdDocName = "STOCK_INC_REC_Append"
DoCmd.OpenQuery sdDocName, acNormal, acEdit

sgDocName = "STOCK_WHSE27"
sgLinkCriteria "[Serial Number]=" & "'" & Me![Serial
Number] & "'"
DoCmd.OpenForm sgDocName, , , sgLinkCriteria

seDocName = "STOCK_INC_Delete"
DoCmd.OpenQuery seDocName, acNormal, acEdit

sfDocName = "STOCK_Incoming"
DoCmd.OpenForm sfDocName, acNormal, acEdit

Exit_addinventory_Click:
Exit Sub

Err_addinventory_Click:
MsgBox Err.Description
Resume Exit_addinventory_Click

End Sub

You're missing an equals sign in this assignment statement:
sgLinkCriteria "[Serial Number]=" & "'" & Me![Serial
Number] & "'"
 
E

EdwardA

Boy dont I feel like a Llama....
-----Original Message-----
While trying to update records using multiple append
queries, from one form and corresponding table, to another
form and corresponding table, I get the error Expected Sub
during the process of refreshing the form.

This is the code I have. I use the items serial number as
a display match, before deleting the row from the data
entry table. This is used to provide visual verification
that the item has indeed been updated.

Im sure its a simple enough solution, but I am not
grasping it.


Private Sub addinventory_Click()
On Error GoTo Err_addinventory_Click

Dim stDocName As String
Dim sdDocName As String
Dim seDocName As String
Dim sfDocName As String
Dim sgDocName As String
Dim sgLinkCriteria As String
Dim shDocName As String
Dim shLinkCriteria As String
Dim siDocName As String
Dim siLinkCriteria As String

RunCommand acCmdSelectAllRecords

stDocName = "STOCK_INC_WHSE27_Append"
DoCmd.OpenQuery stDocName, acNormal, acEdit

sdDocName = "STOCK_INC_REC_Append"
DoCmd.OpenQuery sdDocName, acNormal, acEdit

sgDocName = "STOCK_WHSE27"
sgLinkCriteria "[Serial Number]=" & "'" & Me![Serial
Number] & "'"
DoCmd.OpenForm sgDocName, , , sgLinkCriteria

seDocName = "STOCK_INC_Delete"
DoCmd.OpenQuery seDocName, acNormal, acEdit

sfDocName = "STOCK_Incoming"
DoCmd.OpenForm sfDocName, acNormal, acEdit

Exit_addinventory_Click:
Exit Sub

Err_addinventory_Click:
MsgBox Err.Description
Resume Exit_addinventory_Click

End Sub

You're missing an equals sign in this assignment statement:
sgLinkCriteria "[Serial Number]=" & "'" & Me![Serial
Number] & "'"

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top