Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / March 2007

Tip: Looking for answers? Try searching our database.

Assigning Variable from Combo Box

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rod - 17 Mar 2007 07:34 GMT
  Okay, I'm kind of a newbee to Access. I'll try to explain what I've done
thus far and
what I'm trying to do.
  I've put a combo box (named: Artist1) in a form (named: Artist2) and I've
populated this
 combo box from a table (named: ArtistBand, field named: ArtistBand).
  Everything works fine with that.
  Now, I'm using the "On Not in List" event for new data entries in this
combo box. I,ve
 set the "Limit To List" data to Yes and I,ve added to following info to the
"On Not in List"
 event:
           Private Sub Artist1_NotInList(NewData As String, Response As
Integer)
                   Dim varArtistBand As String
                   varArtistBand = NewData
           Response = acDataErrAdded
     
End Sub

   Now, when I run the form, I get the following Access message:
       "The text you entered isn't an item in the list."
   So, I'm missing something(s) somewhere. Any suggestion?

 Secondly, I'm trying to assign a variable (as shown in the event code above)

   from 21 different combo boxes and, once that is done, added those 21
   variables into 7 different tables (tables that are all linked to each
other in
   some way). At least that's the plan, unless    there is a easier
way/method.

 I've spent quite a bit of time searching through past threads/subjects, but
couldn't
  find anything that addressed what I'm doing.

 Thanks for any assistance you could possible provide.
 Rod
Dirk Goldgar - 17 Mar 2007 13:40 GMT
>   Okay, I'm kind of a newbee to Access. I'll try to explain what I've
> done thus far and
[quoted text clipped - 19 lines]
>        "The text you entered isn't an item in the list."
>    So, I'm missing something(s) somewhere. Any suggestion?

It's not enough just to tell Access that the data has been added to the
table ("Response = acDataErrAdded");  you have to actually add the new
artist to the table yourself.  Something like this:

'----- start of example code -----
Private Sub Artist1_NotInList(NewData As String, Response As Integer)

   CurrentDb.Execute _
       "INSERT INTO ArtistBand(ArtistBand) " & _
           "VALUES(" & Chr(34) & NewData & Chr(34) & ")", _
       dbFailOnError

   Response = acDataErrAdded

End Sub
'----- end of example code -----

Signature

Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

Rod - 19 Mar 2007 07:00 GMT
Dirk,
    Thanks for your reply.
    I understand that I need to add code to get the new typed in info to
 be stored to the 7 different tables, but first, I want to assign a variable
 from all of my 21 combo boxes entries. Then, at the end, have one button
 that will open the corresponding tables and add the new data.
    I believe "Limit To List" data needs to be set to "No", so I'm going
that
  route for now, at least until I find out that the variables are not being
  assigned properly. For now it appears to be working.
    Once again, thanks for your assistance.
     

>>   Okay, I'm kind of a newbee to Access. I'll try to explain what I've
>> done thus far and
[quoted text clipped - 18 lines]
>End Sub
>'----- end of example code -----
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.