Help with this Code please! (1 Viewer)

TurboDieselOne

Registered User.
Local time
Today, 04:11
Joined
Jan 16, 2003
Messages
39
This is the Code I have for the Not on List event on my form

Dim Strsql As String, X As Integer
X = MsgBox("Do you want to add this value to the list?", vbYesNo)
If X = vbYes Then
Strsql = "Insert Into tlkupCounty ([County]) values ('" & NewData & "')"
'MsgBox strsql
CurrentDb.Execute Strsql, DB_FAILONERROR

Response = acDataErrAdded
Else
Response = acDataErrContinue
End If


What I need to do is change the SQL statement so that I can add to the tlkupCounty the Country as well, which is on this form as a seperate combo the datasource for the [County] is :

SELECT tlkupCounty.County, tlkupCounty.Country FROM tlkupCounty;

but the Country column width is set to 0
 

WayneRyan

AWF VIP
Local time
Today, 04:11
Joined
Nov 19, 2002
Messages
7,122
Turbo,

If they respond that they do want to add to the list
then just open up a popup window and ask for the
country. It's OK button can insert into the table.

Wayne
 

TurboDieselOne

Registered User.
Local time
Today, 04:11
Joined
Jan 16, 2003
Messages
39
All I want is to be able to toake the contents of

forms!frmCompany!Country and add it to the
tlkupCounty.Country as the statment adds the County when not in list to tlkupCounty.County

the rowsource of the cboCounty is tlkupCounty.County,tlkupCounty.Country
 

Waltang

Registered User.
Local time
Yesterday, 22:11
Joined
May 21, 2003
Messages
32
Try replacing :

Strsql = "Insert Into tlkupCounty ([County]) values ('" & NewData & "')"


with

Strsql = "Insert Into tlkupCounty ([County],[Country]) values ('" & NewData & "', '" & me!country & "')"
 

Users who are viewing this thread

Top Bottom