How to pick up a number form form to another by selecting it

G

ghost

Greeting,

I have two forms one for sales and the other for cars type. In sales form
there is field of car type which is a number and it there is a button once I
click one it anther form which is cars type which it has two fields one for
car type number and car type description. What I what to do is once the user
select the car , I want access to pick up the care type number only and put
it the field of car type in Sales form, like the calendar form?

How to do that please?
 
D

Dominic Vella

2 ways. It's a bit difficult to explain without knowing exact details, but
I hope I can give you an idea of where to go.

1) Use the OpenArgs in the Types form when you call to:
DoCmd.OpenForm "frmSales", , , , , ,intCarTypeNumber

then use the OpenArgs from the Sales Form_Load():
Msgbox Me.OpenArgs

2) In the Sales form, you could make references to the Type form:
Forms("frmTypes").txtType

I hope this helps.


Dominic
 
G

ghost

hi,
Dominic, both are not working

Dominic Vella said:
2 ways. It's a bit difficult to explain without knowing exact details, but
I hope I can give you an idea of where to go.

1) Use the OpenArgs in the Types form when you call to:
DoCmd.OpenForm "frmSales", , , , , ,intCarTypeNumber

then use the OpenArgs from the Sales Form_Load():
Msgbox Me.OpenArgs

2) In the Sales form, you could make references to the Type form:
Forms("frmTypes").txtType

I hope this helps.


Dominic
 
D

Dominic Vella

I trust that the information I provided was not taken too literally. Too
help better you might want to give me:
* the names of the forms you are using,
* the field names
* the objects (text boxes) names being used too.
 
G

ghost

Forms:
Sales & Cars

Sales has : CarTypeNo

Cars has : CarTypeNo & CarType

Objects: CarTypeNo(textbox) for both
 
D

Dominic Vella

Using method 1
=======
In your Sales form (presuming the button you use to open the Cars form is
called cmdOpenCars:
you should ensure the OnClick event is on for that button, your module
should contain:

Private Sub cmdOpenCars_Click()
DoCmd.OpenForm "Cars", , , , , ,Me!CarTypeNo
End Sub

In your Cars form:
ensure the forms OnLoad event is on, your module should contain

Private Sub Form_Load()
Me!CarTypeNo = Me.OpenArgs
End Sub

================
I hope that's a little clearer


Dom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top