Combo Box field selection help needed

techexpressinc

Registered User.
Local time
Today, 08:28
Joined
Nov 26, 2008
Messages
185
I have a couple comboxes on the form.
I cannot get the highlight value to add to the table. It is always the 1st one, even thou I have highlighted a different client.

My value for & Me!ClientID & is the 1st one not the highlighted one.
My value for & Me!FSWID & is the right one.

I need the ClientID to be the highlight value any suggestions on how.
I included some pictures to help show the problem.

Thx Russ

"
If rs!Inactive = False Then
sql = ("insert into TicklerData(TicklerID,ClientID,FSWID,Item,Due,Sort Order) values (" & maxid & "," & Me!ClientID & "," & Me!FSWID & ",'" & rs![Item] & "','" & DateDue & "'," & rs![SortOrder] & ");")
DoCmd.RunSQL (sql)
End If
 

Attachments

  • formcodeforaddTickler.txt
    formcodeforaddTickler.txt
    1.2 KB · Views: 109
  • Formwithdata.JPG
    Formwithdata.JPG
    24 KB · Views: 109
  • formClientSelectBoxPropertySheet.JPG
    formClientSelectBoxPropertySheet.JPG
    54.2 KB · Views: 121
What if you did

Me!ClientID.column(0)
 
run-time error occured
 

Attachments

  • thecolumn0fixtrythatfailed.JPG
    thecolumn0fixtrythatfailed.JPG
    6.5 KB · Views: 114
How about

Code:
dim combovalue as int
combovalue=me!clientselectbox.column(0)
If rs!Inactive = False Then
sql = ("insert into TicklerData(TicklerID,ClientID,FSWID,Item,Due,Sort  Order) values (" & maxid & "," & combovalue & "," &  Me!FSWID & ",'" & rs![Item] & "','" & DateDue &  "'," & rs![SortOrder] & ");")
DoCmd.RunSQL (sql)
End If
EDIT: I just saw that you have your combobox named clientselectbox.

If you do

me!clientselectbox.column(0)

that should work.
 
Syntax error
on this line:
combovalue = Me!ClientID.Column(0)

combovalue = Me!ClientID.Column(0)
If rs!Inactive = False Then
sql = ("insert into TicklerData(TicklerID,ClientID,FSWID,Item,Due,Sort Order) values (" & maxid & "," & combovalue & "," & Me!FSWID & ",'" & rs![Item] & "','" & DateDue & "'," & rs![SortOrder] & ");")
DoCmd.RunSQL (sql)
End If


attached is the code
 

Attachments

check what i changed it to.

should be me!clientselectbox.column(0)
 
Re: Combo Box field selection help needed -opps closer not there yet

sorry on the oversight
syntax err still

not on this line
DoCmd.RunSQL (sql)
 

Attachments

FYOI: If GenDate is a date field you use the hash (#) character to surround the value and not single quotes.
 
All I needed was the: " & Me.ClientSelectBox & "
I must be a sequence thing. That it was updating the table field Clientid and then some since the field name in the table was Clientid and there was a Clientid in the ClientSelectBox there was a match and that field from the ClientSelectBox was picked.

Thanks for the help.

Russ
 

Users who are viewing this thread

Back
Top Bottom