Connecting Tech Pros Worldwide Forums | Help | Site Map

Need Help with combo box display

Newbie
 
Join Date: Sep 2007
Posts: 27
#1: Oct 25 '07
Hi,

I have a form and i have a combo box that gets loaded with the last name and first name being concatenated at the time of loading into the combobox and i select from that list ...

So the problem is if i select any name then it is breaking up and moving into a second line in the combobox..

Example:

Jason Meyers ----- I select this


Result

Jason
Meyers ---- I dont want it to be like that


I want it to be in the same line as it was displayed and need to remain like that after selection.....


Desired Result:

Jason Meyers




Waiting for help

Thanks
Jason.

nico5038's Avatar
Moderator
 
Join Date: Nov 2006
Location: The Netherlands
Posts: 2,232
#2: Oct 27 '07

re: Need Help with combo box display


Can you post the query that's used to fill the combobox ?

Nic;o)
Newbie
 
Join Date: Sep 2007
Posts: 27
#3: Oct 29 '07

re: Need Help with combo box display


Quote:

Originally Posted by nico5038

Can you post the query that's used to fill the combobox ?

Nic;o)

Expand|Select|Wrap|Line Numbers
  1. Private Sub cboEmployerGroupName_LostFocus()
  2. Dim RsGrpID As DAO.Recordset
  3. Dim RsAgyID As DAO.Recordset
  4. Dim RsClient As DAO.Recordset
  5.  
  6. Set RsGrpID = Db.OpenRecordset("SELECT Grp_ID,Grp_SAddressLine1,Grp_SAddressLine2,Grp_City,Grp_State,Grp_ZipCode,Commission,StateLocalGovtEmp,Agency_ID,Agent_ID,ClientManagerID FROM EmployerGroupDetails WHERE Grp_Name ='" & Trim(cboEmployerGroupName) & "'")
  7. If RsGrpID.RecordCount < 1 Then MsgBox "Records Not Available...": Exit Sub
  8. GrpID = RsGrpID.Fields(0)
  9. txtAddress = RsGrpID.Fields("Grp_SAddressLine1") & " " & RsGrpID.Fields("Grp_SAddressLine2")
  10. txtCity = RsGrpID.Fields("Grp_City")
  11. txtState = RsGrpID.Fields("Grp_State")
  12. txtZipCode = RsGrpID.Fields("Grp_ZipCode")
  13. txtCommission = RsGrpID.Fields("Commission")
  14. txtStateLocalGovtEmp = RsGrpID.Fields("StateLocalGovtEmp")
  15.  
  16. Set RsAgyID = Db.OpenRecordset("SELECT Agency_Name FROM Agency WHERE Agency_ID=" & Val(RsGrpID.Fields(8)))
  17.  
  18. txtAgencyName = RsAgyID.Fields(0)
  19.  
  20.  
  21.  
  22. Set RsClient = Db.OpenRecordset("SELECT ClientManagerName FROM ClientManager WHERE ClientMgrID =" & Val(RsGrpID.Fields(10)))
  23.  
  24. txtClientManager = RsClient.Fields(0)
  25.  
  26. End Sub
  27.  
So here iam trying pull the names from the respective tables...My database is normalized and iam using the ID's to get the respective data....


So when the names are being populated in the text boxes they are appearing in 2 lines....I want them in one straight line inside the text box.....

Thanks
Jason.
nico5038's Avatar
Moderator
 
Join Date: Nov 2006
Location: The Netherlands
Posts: 2,232
#4: Oct 29 '07

re: Need Help with combo box display


When it's just the filling of the textbox try:
Expand|Select|Wrap|Line Numbers
  1. txtClientManager = Replace(RsClient.Fields(0),vbCRLF," ")
  2.  
The original field will have the carriage return (vbCRLF) embedded. What puzzled me is the fact that such a field is also used in the combobox, else the WHERE in your first recordset would't work..

Nic;o)
Newbie
 
Join Date: Sep 2007
Posts: 27
#5: Oct 29 '07

re: Need Help with combo box display


Quote:

Originally Posted by nico5038

When it's just the filling of the textbox try:

Expand|Select|Wrap|Line Numbers
  1. txtClientManager = Replace(RsClient.Fields(0),vbCRLF," ")
  2.  
The original field will have the carriage return (vbCRLF) embedded. What puzzled me is the fact that such a field is also used in the combobox, else the WHERE in your first recordset would't work..

Nic;o)

Hello sir,

Thanks for the reply i will try that ....

I have one more question....

I want the STATE field on my form to accept on 2 chracters like NY,CA etc.....

How do i do that ????

How do i convert all the matter that is entered onto the form to be in capitals.....


Waiting for reply....
Thanks
Jason...
nico5038's Avatar
Moderator
 
Join Date: Nov 2006
Location: The Netherlands
Posts: 2,232
#6: Oct 29 '07

re: Need Help with combo box display


For a State field you define a tblState holding the fields StateShort and StateLong.
Now define a combobox and let the user select from there the state from the longname and store the short (2 character) value.
The combowizard will guide you.

Nic;o)
Newbie
 
Join Date: Sep 2007
Posts: 27
#7: Oct 30 '07

re: Need Help with combo box display


Quote:

Originally Posted by nico5038

For a State field you define a tblState holding the fields StateShort and StateLong.
Now define a combobox and let the user select from there the state from the longname and store the short (2 character) value.
The combowizard will guide you.

Nic;o)

Hello sir,

Thanks for all ur help....

I am building my application using access as the database and 6 people will need to access it and work on it .....So right now as iam the only one using... it is on my system ....so if i hand it over .....how will it be possible for all these people to work on it at the same time .....Because if soem one updates it then those changes should be visible to others also...i mean the updated records....so how do i do that .....what softwares do we need for such a thing......some one was suggesting VSS or CVS ...Is that a right option....

waiting for ur reply....
Thanks
Jason....
nico5038's Avatar
Moderator
 
Join Date: Nov 2006
Location: The Netherlands
Posts: 2,232
#8: Oct 30 '07

re: Need Help with combo box display


Access will support multiple users when the database is set in "Shared" mode. (Default setting in the Database Options form)

The best thing is however to use a "splitted" database. Just check the Helpfile (F1) for the Database split utility. This will allow to change the front-end without havng to mind the production data in the tables.

Nic;o)
Newbie
 
Join Date: Sep 2007
Posts: 27
#9: Nov 8 '07

re: Need Help with combo box display


Quote:

Originally Posted by nico5038

Access will support multiple users when the database is set in "Shared" mode. (Default setting in the Database Options form)

The best thing is however to use a "splitted" database. Just check the Helpfile (F1) for the Database split utility. This will allow to change the front-end without havng to mind the production data in the tables.

Nic;o)

Hello sir,

This is Jason Again.....Thanks for all the suggestions u have given so far....I have a question.....

I have 2 forms and say the 1 st form is the "EMP" ....

2nd form is the "FORM1"....

so i have a button on "FORM1" which was cofigured through the Wizard to open "EMP" FORM....But this "FORM1" in the background should close as i move to the "EMP" form....

This is how i changed the code...Its not working....gives this error....

Wrong number of arguments or invalid property assignment....


Private Sub Command1_Click()
On Error GoTo Err_Command1_Click

Dim stDocName As String
Dim stLinkCriteria As String
Dim stDocName1 As String
Dim stLinkCriteria1 As String

stDocName = "Emp"
DoCmd.OpenForm stDocName, , , stLinkCriteria
stDocName1 = "Form1"
DoCmd.Close stDocName1, , , stLinkCriteria1

Exit_Command1_Click:
Exit Sub

Err_Command1_Click:
MsgBox Err.Description
Resume Exit_Command1_Click

End Sub


Please help waiting for ur reply.....
Thanks...
Jason...
nico5038's Avatar
Moderator
 
Join Date: Nov 2006
Location: The Netherlands
Posts: 2,232
#10: Nov 8 '07

re: Need Help with combo box display


Hi Jason,

Best to start a new thread for this.

We like to keep questions and answers as clear as possible for future readers that might find a Q when Googling. It also attracts more attention from the experts, as I can be on a holiday :-)

Nic;o)
Reply


Similar Microsoft Access / VBA bytes