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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening linked SQL Tables

Status
Not open for further replies.

mkov

Programmer
Sep 10, 2003
203
US
I use the following code in an unbound form to add a new record to a table. I have just converted my Access back-end to SQL and this no longer works. So now I have an Access front-end with a SQL Server back-end. Can someone tell me what I need to change to make this work? I am assuming it has to do with my dim and set statements, but not positive.

Thanks for your help.

Dim cnCurrent As ADODB.Connection
Dim rsComm As ADODB.Recordset
Set cnCurrent = CurrentProject.Connection
Set rsComm = New ADODB.Recordset

rsComm.Open "dbo_tblRepCommissions", cnCurrent, , adLockOptimistic, adCmdTable

With rsComm
.AddNew
![RepNo] = RepNo.Value
![ProductType] = ProductType.Value
![Rate] = Rate.Value
![ProductDescription] = ProductDescription.Value
![Amount] = Amount.Value
![ClientName] = ClientName.Value
![CommissionType] = CommissionType.Value
![Source] = "Manual Input"
![Date] = CommDate.Value
.Update
Label36_Click
MsgBox ("The commission has been entered."), , "Message Alert"
End With
End If

rsComm.Close
cnCurrent.Close
Set rsComm = Nothing
Set cnCurrent = Nothing
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top