Hi...
i am a newbie in VB Programming

right now i am tryng to make a simple programme that will connect VB with an Access Database

Can i use a variable inside connection sintax..?

Something like this....

What i want to do is accessing field NmPeg that suppose to use programming like...

DE.rsPegawai!NmPeg

But how do i use a variable x, like...

x = NmPeg
DE.rsPegawai!x

i'll try many times but always fail...
Please tell me the correct syntax...

Thanks

Recommended Answers

All 8 Replies

Hi,

Use rsPegawai(x)

If you are trying to store value retrived from database then try to use

x=DE.rsPegawai!NmPeg

Hi,

Use rsPegawai(x)

Thanks man... Problem solved... :-)

Hi
if u found any thing usefull. then tell me also.
Shah
E & T Department
Islamabad
Pakistan

Hi,

The pro. way of doing it is using the index of the field for ex: rsPegawai(1)

If you are trying to store value retrived from database then try to use

x=DE.rsPegawai!NmPeg

With that statement, wich record will be store in x value??
Assume that i have a lot of record in field NmPeg

the variable will store the first reord from the NmPeg field of your recordset . But for that you need to use movefirst of the recordset.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.