Open Table issue

grego9

Registered User.
Local time
Today, 15:15
Joined
Mar 19, 2008
Messages
41
I have added a button onto my form to simply open a table I have called Internal SSI - this is the code I have added to the button - but the code doesn't work! - Any ideas? it must be to do with the DoCmd.OpenTbl bit - but what should enter in its place?

Private Sub Command4_Click()
On Error GoTo Err_Command4_Click

Dim stdocname As String
Dim stLinkCriteria As String

stdocname = "Internal SSI"
DoCmd.OpenTbl stdocname, , , stLinkCriteria

Exit_Command4_Click:
Exit Sub

Err_Command4_Click:
MsgBox Err.Description
Resume Exit_Command4_Click
End Sub

thanks
 
Here's a quick stab - Why did you abbreviate table in the command?

DoCmd.OpenTbl stdocname, , , stLinkCriteria

Should be:

DoCmd.OpenTable stdocname, , , stLinkCriteria

???
 
Fixed!

Ignore me - I've sussed it -I didn't need the link criteria bit - so I deleted all that and it worked fine
 
Combo Box passing value to Query

Thanks - The full Table command works - when I remove all the link criteria - but I now have another problem I am trying to pass the result of a combo box(combo13) to a query(Business Unti Select2. This query has [Forms]![Business Unit Selector2]![Combo13] in the criteria field of the relevant field). I have set up a button on my form (called Business Unit Selector2) which tries to pass the value of the combo box back to the query and then return the query results....but I keep getting this error message "Wrong number of arguments or invalid property assigned". The code breaks down where I have put **** either side.....

Private Sub Command10_Click()
On Error GoTo Err_open_Click

Dim stdocname As String
Dim stLinkCriteria As String

If IsNull([Combo13]) Then

stdocname = "Internal SSI"
DoCmd.OpenForm stdocname, , , stLinkCriteria

Else

stdocname = "Business Unit Select2"
*****DoCmd.OpenQuery stdocname, , , stLinkCriteria*****

End If

stdocname = "Business Unit Selector2"
DoCmd.Close acForm, stdocname

Exit_open_Click:
Exit Sub

Err_open_Click:
MsgBox Err.Description
Resume Exit_open_Click

End Sub

The strange thing is that If I replace this code with the following "DoCmd.OutputTo acOutputQuery, stdocname, , , stLinkCriteria" - it works ok - but I do not want to export the results - I just want to see them!

any ideas?
 

Users who are viewing this thread

Back
Top Bottom