Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Check Box Selection 1

Status
Not open for further replies.

srpatel

Programmer
Mar 7, 2006
41
GB
Hi,

Am a beginner with access development and require some help.

I have a form called 'frmSelectCode' which has Two Text Boxes and a
Checkbox. The text boxes are bound to the values from Table
'tblAllCodes'. In total there are about 66 fields.

On the main form, there is a Cmd Button that has an onClick Event,
which calls frmSelectCode. This opens up and a user is presented with
all the fields and checkboxes besides the field to choose from.

At present users can select as many check boxes as they want. I would
like this to be limited to have only one checkbox selected at one time.

Could someone point to the right direction.

Thanks
Shreekant :)
 
Might want this to before the docmd.echo(true):

DoCmd.GoToRecord acDataForm, Me.Name, acGoTo, lngCurrRec
DoCmd.Echo (True)

Takes you back to the current record.
 
heya MajP,

Thanks for your support, its much appreciated. Just another quick question with regard to this, I have been reading up on DAO and ADO and I wanted to know, is it possible to write the following script in ADO?

Is it better than DAO?

Thanks
Shreekant
 
That is a pretty big discussion issue with lots of opinions. Microsoft says someday that DAO will no longer be supported, and you should start migrating over to ADO. ADO is much more robust, but has more overhead. Yes you could use ADO, but in this case DAO is easier since
Me.Recordset
returns a DAO recordset not an ADO recordset. If you did this

dim myRs as ADODB.recordset
set myRS = me.recordset 'me.recordset returns a DAO RS

you would get a type mismatch error since an ADO recordset is a different "type" than a DAO recordset

However, it is good practice to work with ADO, I am just lazy and do it the old way.
 
Hey Maj,

Thanks for the ADO info. Just want to revert back to the select button.

When a user selects the relevant code from frmSelectCode it pulls the LCSCode and LCSDesc from tblAllCodesdetails.

These two pieces of information are given in a combo box called LCSCodeID. How can I have this information automatically available in the combo box upon selection, instead of users having to select it again from the drop down.

Note: This is only happens when a LCSCode/LCSDesc has not been used. For existing records it appears automatically.

Please let me know if its possible.

Cheers
Shreekant
 
Not sure if I understand the question, but I think you want to requery the combo box try this in the code.

...code
LCSCodeID.requery
end sub

PS. Always give your controls different names then the fields that they are based on. It is good coding and can avoid some serious corruption issues. Something like
cmboLCSCodeID
would be much better.
 
Actually to be more accurate
me.LCSCodeID.requery
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top