Combo Box - Change forms

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a combo box on a form and when the combobox is selected there are 3
options to choose from. I am trying to find out how its possible that on 1 of
the options how I can transfer some of the data from this form, like
Engineer, JobNumber, JobDate, Address onto another form, and also populate
another table in the database with all this information, how is this possible
to do?
 
Hi again Jez,

I assume you wanna click a button to open form_B so on click of a button you
can put this code

select case combo
case 1
'do something or nothing
case 2
' do something else or nothing again
case 3 'I put the code you are looking for if the value of combo is 3
dim db as database
dim rec as recordset

set db=currentdb
set rec=db.openrecordset("select * from table you want to add the
value",dbopendynaset)
rec.addnew
rec![Engineer]=me![Engineer]
rec![JobNumber]=me![JobNumber]
etc.
rec.update
rec.close
db.close
'now you've added the values to the table
docmd.openform"form_B" 'this open form_B. If form_B is already
opened avoid this line
Forms![form_B].Form![Engineer] = Me!Engineer
etc.
'now you opened form_B and poputed it with the value you want
case else
msgbox "Hey dummy, select something from the combo!,"48","Title of
the msgbox"
end select

HTH Paolo
 
Thanks again paolo.

I have another issue before I can test this I have found out. I have put it
in another thread under ComboBox_GetFocus

Paolo said:
Hi again Jez,

I assume you wanna click a button to open form_B so on click of a button you
can put this code

select case combo
case 1
'do something or nothing
case 2
' do something else or nothing again
case 3 'I put the code you are looking for if the value of combo is 3
dim db as database
dim rec as recordset

set db=currentdb
set rec=db.openrecordset("select * from table you want to add the
value",dbopendynaset)
rec.addnew
rec![Engineer]=me![Engineer]
rec![JobNumber]=me![JobNumber]
etc.
rec.update
rec.close
db.close
'now you've added the values to the table
docmd.openform"form_B" 'this open form_B. If form_B is already
opened avoid this line
Forms![form_B].Form![Engineer] = Me!Engineer
etc.
'now you opened form_B and poputed it with the value you want
case else
msgbox "Hey dummy, select something from the combo!,"48","Title of
the msgbox"
end select

HTH Paolo

Jez said:
I have a combo box on a form and when the combobox is selected there are 3
options to choose from. I am trying to find out how its possible that on 1 of
the options how I can transfer some of the data from this form, like
Engineer, JobNumber, JobDate, Address onto another form, and also populate
another table in the database with all this information, how is this possible
to do?
 
Back
Top