Updating Combo box if Table is in SQL Backend
- From: "dunkster via AccessMonster.com" <u7735@uwe>
- Date: Fri, 30 Jun 2006 07:25:51 GMT
I have SQL 2000 back end and Access 2003 front. I am able to update the tbl
via the Combo Box if it's created in Access with primary key as Autonumber
see code below. I cannot update the Combo Box if the tbl is created in SQL.
What code must I include to achieve this ?
Private Sub Competitor_NotInList(NewData As String, Response As Integer)
Response = acDataErrContinue
'Propmpt user to verify if they wish to add new value
If MsgBox("Competitor" & NewData & " is not in list. Add it ?", vbYesNo) =
vbYes Then
Dim db As Database
Dim rstCompetitor As Recordset
Dim sqlCompetition As String
Set db = CurrentDb()
sqlCompetiton = "Select * from Competition"
Set rstCompetitor = db.OpenRecordset(sqlCompetition, dbOpenDynaset)
rstCompetitor.AddNew
rstCompetitor![Competitor] = NewData
rstCompetitor.Update
Response = acDataErrAdded
rstCompetitor.Close
End If
End Sub
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-adp-sqlserver/200606/1
.
- Follow-Ups:
- Re: Updating Combo box if Table is in SQL Backend
- From: Sylvain Lafontaine
- Re: Updating Combo box if Table is in SQL Backend
- Prev by Date: Re: Modifying Sql server data through Access
- Next by Date: RE: transferspreadsheet is very slow
- Previous by thread: Re: Query limitation
- Next by thread: Re: Updating Combo box if Table is in SQL Backend
- Index(es):
Relevant Pages
|