D
Dane.
Hi all,
This is a continuation of a thread I posted a little while ago
trying to get a combo box working...
SITUATION:
* I have 2 TABLES (and matching input FORMS) in my database: a LIBRARY
USERS Database and a CARD GENERATOR database.
- The LIBRARY USERS database contains records of people containing
information (columns) like first name, last name, contact number,
etc...
- The CARD database is a table which stores information (input by
the user) which is used to generate an identification card (for as
many people as input by the user, i.e.: stored in this table) via a
REPORT (using a query). This table has only a first ("FirstName") and
last name ("LastName") column (obviously, based on the LIBRARY USERS
TABLE).
PROBLEM:
* What I'm trying to do is make the "FirstName" combo box in the CARD
GENERATOR FORM only display the "First Names" for those people
matching the "LastName" field in this form (from the LIBRARY USERS
table)..
* So, for example; if I have 3 people/records:
1) Joe Smith
2) Mary Smith
3) Bob Jones
When I select "Last Name" SMITH in the CARD GENERATOR FORM, it will
only display JOE and MARY in the "First Name" combo box (first and
last name sourced from the LIBRARY USERS table [and stored in the CARD
GENERATOR table]).
- I have successfully setup a "Last Name" combo box to source its
data from the "LastName" section in my LIBRARY USERS table (using a
query) and save it into to the CARD GENERATOR table (using RowSource =
"SELECT [Library Users Database].LastName, [Library Users
Database].LastName FROM [Library Users Database] ORDER BY [LastName];"
in the "LastName" combo-box properties).
* I have no idea how to setup the "FirstName" combo box. A previous
(and only) suggestion was:
"In the AfterUpdate event for the Last Name combo box, add code
similar to this:
Dim strSQL As String
strSQL = "Select FirstName"
strSQL = strSQL & "From [USERS] "
strSQL = strSQL & "Where LastName = " & Me!LastName
Me!FirstName.RowSourceType = "Table/Query"
Me!FirstName.RowSource = strSQL
End Sub
"
but this didn't work (I kept on getting the error on the "Me!" lines:
"Run-time error '438'. Object doesn't support this property or
method").
Can any brave person help with this problem? I apologise for the
copious amount of info in this email, I hope it makes sense to
someone!
Regards,
Dane.
This is a continuation of a thread I posted a little while ago
trying to get a combo box working...
SITUATION:
* I have 2 TABLES (and matching input FORMS) in my database: a LIBRARY
USERS Database and a CARD GENERATOR database.
- The LIBRARY USERS database contains records of people containing
information (columns) like first name, last name, contact number,
etc...
- The CARD database is a table which stores information (input by
the user) which is used to generate an identification card (for as
many people as input by the user, i.e.: stored in this table) via a
REPORT (using a query). This table has only a first ("FirstName") and
last name ("LastName") column (obviously, based on the LIBRARY USERS
TABLE).
PROBLEM:
* What I'm trying to do is make the "FirstName" combo box in the CARD
GENERATOR FORM only display the "First Names" for those people
matching the "LastName" field in this form (from the LIBRARY USERS
table)..
* So, for example; if I have 3 people/records:
1) Joe Smith
2) Mary Smith
3) Bob Jones
When I select "Last Name" SMITH in the CARD GENERATOR FORM, it will
only display JOE and MARY in the "First Name" combo box (first and
last name sourced from the LIBRARY USERS table [and stored in the CARD
GENERATOR table]).
- I have successfully setup a "Last Name" combo box to source its
data from the "LastName" section in my LIBRARY USERS table (using a
query) and save it into to the CARD GENERATOR table (using RowSource =
"SELECT [Library Users Database].LastName, [Library Users
Database].LastName FROM [Library Users Database] ORDER BY [LastName];"
in the "LastName" combo-box properties).
* I have no idea how to setup the "FirstName" combo box. A previous
(and only) suggestion was:
"In the AfterUpdate event for the Last Name combo box, add code
similar to this:
Dim strSQL As String
strSQL = "Select FirstName"
strSQL = strSQL & "From [USERS] "
strSQL = strSQL & "Where LastName = " & Me!LastName
Me!FirstName.RowSourceType = "Table/Query"
Me!FirstName.RowSource = strSQL
End Sub
"
but this didn't work (I kept on getting the error on the "Me!" lines:
"Run-time error '438'. Object doesn't support this property or
method").
Can any brave person help with this problem? I apologise for the
copious amount of info in this email, I hope it makes sense to
someone!
Regards,
Dane.